Only one attribute rule triggers with multiple edits in portal map.

94
1
a month ago
Highlighted
New Contributor

I have five attribute rules on a feature service layer.  Each one is supposed to update a "<field>LastEdit" attribute.  Where I have five fields [JobStatus, WorkOrder, EstCompletionDate, DueDate, Dispatch] and their respective trackers [JobStatusLastEdit, WorkOrderLastEdit, EstCompletionDateLastEdit, DueDateLastEdit, DispatchLastEdit].

Each rule looks like:

if ($originalFeature.JobStatus == $feature.JobStatus){
return $feature.JobStatusLastEdit
} else {
return Now()‍‍
}

When in Pro, I can edit all five fields and save my changes and each respective LastEdit field will be updated.  
When in a Portal map, I edit all five fields and only the last field to be edited gets it's LastEdit field updated (I've tried every combination).

Using Fiddler, I noticed that EACH Portal update sends a REST post for applyEdits individually while Pro sends a REST post for updates all at once.  I can't figure out why the applyEdits Post from Portal map isn't triggering all the rules. Is there something I need to do with versioning or another configuration I missed before deploying the FS?

Reply
0 Kudos
1 Reply
Highlighted
New Contributor

I was able to resolve this but I still think it should have worked with the first code I posted.  By checking the database after every entry, I figured out that any fields not being edited were getting the wrong value. By switching from $feature.attribute to $originalFeature.attribute I was able to get the desired results.

if ($originalFeature.JobStatus == $feature.JobStatus){
    return $originalFeature.JobStatusLastEdit
} else {
    return Now()
}
Reply
0 Kudos