How to update form field value based on the related list record field value by using Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 01:38 AM
Hi Community,
I have a requirement to update skill field on the case form when ever the Task skills related list is updated with a skill
I have written before insert Business rule but it's not working
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery('sys_id',current.skill);
gr.query();
while(gr.next())
{
gr.skills = current.skill;
gr.update();
}
})(current, previous);
Can any one have any better idea ?
Thanks,
Harikrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:01 AM
did you update the script with proper field name? is it working or not?
If not please add proper logs in the script to debug where its going and wlat values is it getting.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 02:46 AM
Hi Hari,
You can also use after BR for this requirement. Please try using the same code posted by you ( remove update() ) or make use of anurag's code. it should work ideally.
Note: I see you are querying Single record in second line, while is also can be removed. Go with If directly.
Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 03:58 AM
Hi,
Please write a After Update Business Rule on your Child table i.e. Task Skills and put a condition as below:
Skills Changes
Script to be used here:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('Table Name'); // Replace your Parent table Name here
gr.addQuery('sys_id',current.incident); // Replace Incident with the Field which is connecting both tables
gr.query();
if(gr.next()){
gr.Parent_FIELD = gr.Parent_FIELD + current.CHILD_FIELD;
gr.update();
}
})(current, previous);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:25 AM
Hi shloke04,
Thanks!! for the response
I tried that but it is not working, the skills field on the case form is List collector type does this make any conflict?
Thanks,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 05:13 AM
It should not because I have tried it in my PDI with Watch List type field which is also a multi select field and works fine.
Can you share what you have configured as a Business Rule including the condition as well?
Regards,
Shloke
Regards,
Shloke