How to use scripting to auto-update RTC attributes based on a trigger
One answer
If by "scripting", you mean JavaScript, please see the below articles, particularly the Calculated Value provider.
https://jazz.net/library/article/537
https://jazz.net/wiki/bin/view/Main/AttributeCustomization