- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 04:10 AM
Hi,
Any idea on how to auto populate description field in incident form from particular catalog item's variable.
I have written a business rule:
When to run: After Insert
Advance:
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("incident");
gr.addQuery("sys_id=552c48888c033300964f4932b03eb092");
gr.query();
while (gr.next())
{
gr.description = current.variables.short_description;
}
current.update();
})(current, previous);
Thank in advance.
Solved! Go to Solution.
- Labels:
-
Incident Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:04 PM
Hi,
so you have set the BR as after insert
on which table and how is this BR triggered?
try this
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("incident");
gr.addQuery("sys_id=552c48888c033300964f4932b03eb092");
gr.query();
if(gr.next())
{
gr.description = current.variables.short_description;
gr.update();
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:04 PM
Hi,
so you have set the BR as after insert
on which table and how is this BR triggered?
try this
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("incident");
gr.addQuery("sys_id=552c48888c033300964f4932b03eb092");
gr.query();
if(gr.next())
{
gr.description = current.variables.short_description;
gr.update();
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:14 PM
Hello.
Thank you so much. This is now working.
Root Cause: current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 11:18 PM
Glad to help.
Please mark response helpful as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader