Hi there,
I successfully set up an attribute rule in ArcGIS Pro that automatically updates attributes in a parent feature class once the child related table is modified. The idea behind this is when people update the most recent date of maintenance (in field maps), the parent feature class automatically stores the most recent date of maintenance as well.
The issue is, once I published this data as a web map and updated the related table in Field Maps, the changes do not transfer over to the parent feature class like they did in ArcGIS Pro. Does anyone know why this is? I tried to play around with calculated fields in Field Maps but when I copied the arcade expression from ArcGIS Pro into Field Maps, Field Maps gave me an error saying "Field Could Not Be Calculated."
I'm unsure what to do since the whole purpose of this attribute rule is to function with Field Maps. Any help is greatly appreciated! Here is my attribute rule code for reference (ignore the sloppy naming conventions):
// Calculation Attribute Rule on PruneMaint table
// Triggers: Insert, Update
// Execution: Exclude from application evaluation
// Field: LastPruningDate
var prune_date = First(FeatureSetByRelationshipName($feature, "PruneMaintenance2PruneMaint"))
if($originalfeature.LastPruningDate == $feature.LastPruningDate) { return null }
// get attributes from prune_date
var old_attributes = {
"LastPruneDate": prune_date.LastPruningDate
}
// map the attribute names from the work table to the feature class
var update_attribute_map = [
["LastPruningDate", "LastPruningDate"]
]
// if the new attributes are filled in, add them to the edit request
var updated_attributes = Dictionary()
for(var i in update_attribute_map) {
var work_att = update_attribute_map[i][0]
var asset_att = update_attribute_map[i][1]
var new_att = $feature.LastPruningDate
var old_att = prune_date[asset_att]
if(!IsEmpty(new_att)) {
updated_attributes[asset_att] = new_att
}
}
var edit = [{"className": "PruneMaintenance40", "updates": [{"globalID": prune_date.GlobalID, "attributes": updated_attributes}]}]
return {
"edit": edit
}