I have a Field Maps app that is used to update a tree inventory. The data is stored in an sde database and edited via a branch-versioned feature service. There is an attribute rule that creates a unique id for each tree point using a database sequence (see below). The rule executes on Insert operations only. The first part of the code prevents existing IDs from being overwritten which is useful for cases where a tool like Append is used in Pro.
The problem I'm having is that when editors use the Copy Features tool in Field Maps, the treeID value of the point being copied gets copied to multiple points. The field isn't editable or visible in the Field Maps form (see attached form configuration). However, it appears that the field value is still getting copied, and the attribute rule isn't returning anything since it sees a value in the field. I'm using ArcGIS Enterprise 11.1 and using the form tool in Map Viewer.
Is there a way to prevent this field from being copied with the copy features tool? Or another workaround?
if (!isEmpty($feature.treeID)){
return;
}
var sequence = NextSequenceValue("TREEID");
var prefix = "TREE";
var assetid = prefix + sequence;
return Text(assetid);
My organization has almost this exact same scenario, except the attribute rule is set to run on updates and is excluded from application evaluation. Maybe try those settings and see if copying features still results in duplicate IDs? I'm not sure why my organization wouldn't have the same problem since the expression should still only apply to features with an empty ID, but I've tested in Pro and Field Maps and wasn't getting duplicates. It could also be a setting that was applied upon the database sequence creation.