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,

Glad to know that script I shared worked fine.

Are you having any field on CHG which refers RITM? then only you can bring the RITM's field/variable values to CHG form?

Regards
Ankur

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

Yes Ankur,

 

When i open a change form and configure form layout then i see requested items which looks like this when i taken on to the form

 

find_real_file.png

Hi,

how is the CHG created? what is the relationship between CHG and RITM

Example: In sc_task table there is a field request_item which stores RITM so when you are on RITM form and in the related list of Catalog Task when you do New the RITM number auto populates and you can bring the RITM data on SC Task form

In your case is such scenario present?

Regards
Ankur

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

No,

Actually i opened the RITM and configure related lists, and then taken Change Requests on to the form. Then in the RITM related lists, Change Requests tab will be there. So once RITM is created, and then if we go to change requests tab which is present in the RITM related lists, then if we click new, the Change form opens, SO at that point of time i want to populate Short description and Description of RITM variables to SD and Description on CHange form. So is it possible to do like that?

 

 

 

Regards,

Indup

Hi,

not possible unless you have any field on CHG which is reference to sc_req_item table

Create New field on change_request table of type reference to sc_req_item table

I assume field name is u_ritm

Once done you can use before insert BR on chg table and use this script

current.short_description = current.u_ritm.short_description;

current.description = current.u_ritm.description;

Regards
Ankur

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