I am using trigger rules in SWEET for ArcGIS to add records to a feature service (logging dataset) whenever there is a change to a primary dataset. I can get this to work if the logging dataset is just a table, but I also want to pass through the original geometry (polygons) of the features that were modified. In the 'Globals' tab in arcade, there seem to be plenty of options to reference the original geometry, however I can't seem to get any of these to work in my script. What am I missing here? Do I need to have separate scripts based on the type of edit? (i.e. one script if new features are added, and another script if features are modified?)
I feel like I'm missing something very simple!
Trigger setup in SWEET: setup in the Data Rules Editor --> selected the layer to watch --> created trigger.
Trigger event: Post all changes
Data Changes: add records
Layer to apply changes to: hosted feature service (empty polygon dataset)
Arcade Script:
var Edited_Date = Timestamp()
var DCA = FeatureSetByName($modifiedFeatures,"DCA");
var Name = ""
var OID = ""
var geom = geometry(DCA) This is where the script fails. If I set geometry to null and switch the layer to a table, the rest of the script works.
for (var k in DCA){
var Name = k.Name
var OID = k.OBJECTID
}
return Feature(geom, { DCA_ID: OID, DCA_NAME: Name, EDIT_TYPE: $operationName, EDITED_BY: $userId, EDIT_DATE: Edited_Date});
Execution Error:Unexpected token o in JSON at position 1