Please help me with the BR where I need to populate the value from a list type field to related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 02:25 AM
I am having a field ABC in a form where the field type is list and referring to table MNC. In the same form I have related list as "Relations" where it is referring to the same ABC table. I want the values provided in ABC field should populate the same in Relations. it would be whenever there is an update in the field value it will reflect the same in the below related list.
I want this to be done by a after update BR. Can anyone help me with the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 02:30 AM
hi please check below code
(function executeRule(current, previous /*null when async*/) {
var newABCValue = current.ABC;
var rel= new GlideRecord('MNC');
rel.addQuery('ABC', newABCValue);
rel.query();
while (rel.next()) {
rel.ABC = newABCValue;
rel.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 04:45 AM
This will not work in case I am having multiple record in the field ABC (as this is a list type of field). Can you suggest this code using array ?