Update description with caller name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 04:41 AM
Requirement : Description needs to be updated as caller name after update using business rule.
I have tried below code but its not working.
var gr = new GlideRecord('incident');
gr.addQuery('caller_id.name',current.caller_id.name);
gr.addQuery('description',current.description);
gr.query();
while (gr.next())
{
return current.description=current.caller_id.name;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 04:51 AM
Hi @Ajitsure ,
On which table your are trying this ? if on incident then you can write down one line of code as
// Update the description field with the caller's name
current.description = current.caller_id.name;
Create before update BR on incident table with condition as caller changes.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 05:08 AM
Hi Kiratkar,
Why cant we use after update BR?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 05:10 AM
Hi @Ajitsure ,
If you use after BR then you will have to use current.update() in script and that is not good practice at all.
So better to go with before update BR which can update the record before record gets updated into the database.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 05:25 AM
Hi Kiratkar,
Can you please share me a piece of code using after BR