Is there a way to trigger an attribute rule on insertion of a related feature?

1450
1
Jump to solution
04-02-2020 06:23 AM
WillHouston
New Contributor III

I have an attribute rule that updates a field with the newest creation date of related records in a relationship class:

var results = FeatureSetByRelationshipName($feature, "Post_To_Sign", ['*'], false);
var latest = null;
for (var r in results) {
     if (latest == null) latest = r;
     if (latest.creationdate < r.creationdate) latest = r;
}

return latest.creationdate;

(I assume there is an Arcade function that would return the record with the max creationdate, like Max, but I didn't feel like figuring out the syntax).

Right now that attribute rule only updates when I update the "one" side of the 1:M relationship. What I would like to do is trigger that attribute rule when a related feature is created. Is there a way to trigger that? Features seem to be immutable, or else I would just create an attribute rule on the related record to update that field on insert.

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Will Houston ,

A trigger will only fire on the current layer. However, to be able to achieve what you mentioned, you should configure the attribute rule on the related feature or table and insert into the other featureclass. Hussein Nasser has published a blog explaining how to do this: Advanced Attribute Rules - Editing features on another class with attribute rules 

I also recommend reading his other blogs: https://www.esri.com/arcgis-blog/author/hussein-nasser/  

View solution in original post

1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Will Houston ,

A trigger will only fire on the current layer. However, to be able to achieve what you mentioned, you should configure the attribute rule on the related feature or table and insert into the other featureclass. Hussein Nasser has published a blog explaining how to do this: Advanced Attribute Rules - Editing features on another class with attribute rules 

I also recommend reading his other blogs: https://www.esri.com/arcgis-blog/author/hussein-nasser/