We have 2 objects with one-to-many relationship between them. Let's say, those are List and ListItem On some field change in List, we want to update all related ListItems and run triggers there... Is there any solution for that? Should I use Object Script trigger? I've tried with Update Field Value trigger, but it updates only ONE related record instead of all. Regards, Yurii
Yes, Object Script trigger has to be used in List object. The Formula script should contain a loop to loop through all the related records of Listitems object. API ‘rbv_api.setFieldValue(objName, objId, fieldname, newValue)’ should be used to update related record’s fields.
Steps to follow:
1. Create a trigger in List object of type ‘Object Script’
2. In trigger definition select a field from ‘On Field Change’ dropdown which should run the trigger
3. Enter the script to update related records fields in Formula field. A sample script is given below
{!#LOOP_BEGIN.R776256#776214}
rbv_api.setFieldValue("listitem", {!R776256.id}, "firstName", "testing");
{!#LOOP_END.R776256}