The CreatorCon Call for Content is officially open! Get started here.

Need to Populate Short description and description RITM variables on newly opened Change Request

Indup
Tera Expert

HI guys,

There are two variables on RITM, Short Description & Description. If we open the RITM, in the related lists there is Change Request tab. So once we go to that Change Request tab and click new, it will give 3 options Normal, Standard and Emergency. Whatever we select, the change request form gets open. Then in that Change form i want to populate Short Description and Description fields with the values of Short Description and Description of RITM variables. FOr that i have written a BR and its not working. Can someone correct my code plz

my BR:

Table: sc_req_item

after-->insert

Script:

var a = new GlideRecord('change_request');
a.initialize();
a.get(current.sys_id);
a.short_description = current.variables.short_description;
a.description = current.variables.description;
a.insert();

 

Regards,

Indup

23 REPLIES 23

Hi,

I have updated your existing BR

var gr = new GlideRecord('change_request');
    gr.initialize();
    gr.u_requested_item = current.sys_id;
    gr.short_description = current.variables.u_short_description;
    gr.description = current.variables.u_description;
    gr.insert();

I was not able to check how the New button is taking to the interceptor page

I created another BR before insert. check if that helps

find_real_file.png

Regards
Ankur

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

Hello Ankur,

 

I have tried with Script Include and on Load CS on Change Request table. Its not working anyway but is there any chance you could correct the code?

my SI:

find_real_file.png

 

onLoad CS on Change Request table:

find_real_file.png

Hi,

use this to get the variable values while forming the json

gr.variables.u_short_description.getDisplayValue()

gr.variables.u_description.getDisplayValue()

Regards
Ankur

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

No Ankur,

I have given log message at SI side like

gs.log("SD is "+gr.variables.u_short_description.getDisplayValue());

this log message is not coming in the logs

 

 

Regards,

Indup

Hi,

please check variable name is proper or not

Regards
Ankur

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