- 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 08:03 AM
Hi,
Are you trying to update any specific incident? If yes, then what is "When to Run" condition setup to?
Regards,
Palak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 10:29 PM
Hi Palak,
Yes, I am trying to update a specific record in incident table.
When to Run is set to After Insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2022 10:34 PM
Hi,
Do you want to set description of the incident which got submitted with the description variable
are you sure the incident got generated as part of some record producer?
if yes then are you giving correct variable name?
no need to query then
you can directly use record producer script
current.description = producer.short_description;
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 10:56 PM
Hello,
No, the incident is not generated from catalog item.
I just need to update the description field in incident form from the value available in short description variable which is present in Task - 1 catalog item.