Select to view content in your preferred language

How to update a parent field when a related child field changes using Arcade?

3708
10
Jump to solution
09-18-2020 10:42 AM
TheodoreRakel
Occasional Contributor

I'm writing an immediate calculation attribute rule using Pro version 2.6.1.  I have a relationship defined between a parent feature and children objects.  Whenever the user changes either the parent or any of its children, I need to update a field on the parent feature.  Is this possible using Arcade and immediate calculation attribute rules?  I've written the rule and it works fine when I change the parent feature, but it doesn't fire when I change the related child objects.  Then I began writing a second rule for the child object, but I realized that I would ultimately be changing something on the parent feature, which I do not think can be done using Arcade and immediate calculation attribute rules.  The rule would also have to execute whenever a new object is related to the parent or an existing object is unrelated from the parent.

0 Kudos
10 Replies
TheodoreRakel
Occasional Contributor

I do not see the code that I wrote getting executed when I unrelate.  I wrote a simple calculation rule to set the 'model' field to the current time stamp whenever there's an update to the child row.  It works when I modify a field on the ElectricDeviceUnit as shown below:

Before update to the 'notes' field

After update to the 'notes' field:

However, when I do an unrelate, the attribute rule does not seem to execute:

After unrelating the child from the parent:

The 'model' field did not get the current time stamp.  It stays null.  It seems that the code I wrote for the attribute rule did not execute as a result of doing an unrelate.  I'm using Pro version 2.6.1.

0 Kudos