How to update description field in incident table from specific catalog item's variable ?

Bishal Sharma
Tera Contributor

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.

1 ACCEPTED SOLUTION

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello.

 

Thank you so much. This is now working.

 

Root Cause: current.update();

                   

Glad to help.

Please mark response helpful as well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader