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 05:27 AM
Okay.
Then use below
current.description = current.caller_id.name;
current.update();
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:52 AM - edited 12-29-2022 05:53 AM
Hi Ajitsure,
You can write the business rule after the update
current.description=current.caller_id.name;
current.setWorkflow(false); //to avoid recursion
current.update();
Please mark my response as Correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2022 06:47 AM
From a ServiceNow standpoint, I can only strongly advise against setting this up as an on after Business Rule and using current.update()
You can find detailed information on Now Support about what issues this will cause.
The first step would be to understand why the name should be copied to the description. The name is already stored in sys_user and you can easily dotwalk there during filtering or reporting.
If there is a clear business requirement to do so, you won't need to write a single line of code to achieve this.
Just create a Flow that reacts on Caller changes;
and then update the Incident: