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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 05:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:19 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:36 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:55 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader