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 05:17 AM
Hi,
it should be this
Also set the parent of CHG as RITM
var a = new GlideRecord('change_request');
a.initialize();
a.parent = current.sys_id;
a.short_description = current.variables.short_description;
a.description = current.variables.description;
a.insert();
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 05:31 AM
If you want fields then it should be this
var a = new GlideRecord('change_request');
a.initialize();
a.parent = current.sys_id;
a.short_description = current.short_description;
a.description = current.description;
a.insert();
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 05:51 AM
Hello Ankur,
I have already written that above code previously and tried. I can try now with some changes in the code but currently my instance is down. So i will wait and will comeback
Regards,
Indup

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 06:06 AM
Its working, but here what i want is, when we go to related lists and go to change request tab, and if we click on new, then only a new change form will be opened and in that new change form these values should populate. So for that do we need to modify "new" button UI action?
Regards,
Indup