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-10-2022 12:40 AM
Hi Hari. I noticed that in your code
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery('sys_id',current.skill);
gr.query();
while(gr.next())
{
gr.skills = current.skill;
gr.update();
}
line number 2 you are using the wrong field in the query. as current.skill is sys_id of the skill record.
You need to use current.task to get the case record. please update the query as follows
gr.addQuery('sys_id',current.task);
Please mark it as helpful/correct If my answer is helpful in any way,
Best regards,
Thameem