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 01:47 AM
Hi,
Try this
(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())
{
if(gr.skills == '')
{
gr.skills = current.skill;
}
else
{
gr.skills = gr.skills + ',' + current.skill;
}
gr.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 03:11 AM
Hi Anurag,
Thanks!! for responding
I have tried your code after/before update but it's not working skill field still showing empty
any thing needs to change ?
Thanks,
Harikrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 03:41 AM
what is the field name, skill or skills,
some place its skill and some place in the code its skills. Fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 03:58 AM
The field on the Case form is 'skills' and in the related list table Task Skill [task_m2m_skill]
is 'Skill'