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:59 AM
So, if i create a reference field (u_ritm) on Change Request, then i need to pass the RITM number to that field. So using BR i can do that right? And using the before insert BR, can i populate all the three? RITM, SD and Description?
And as i mentioned, can i do this once i click the New button of change request?
Regards,
Indup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 07:05 AM
Hi,
Once you create new Field on CHG u_ritm
Then you click New on CHG in the related list RITM field will be auto-populated
Now you just need to use before insert BR on change_request and fetch the field/variable values using this Reference field.
BR Condition: current.u_ritm != ''
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.short_description = current.u_ritm.short_description;
current.description = current.u_ritm.description;
// OR
current.short_description = current.u_ritm.variables.variable1;
current.description = current.u_ritm.variables.variable2;
})(current, previous);
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 07:14 AM
Ankur,
I ordered a cat item and when i click New button for CHange Requests on RITM related lists, It is showing Standard, Normal, Emergency links. SO i clikced on Normal, then a new change form got opened but the RITM number is not populating in u_ritm field
Regards,
Indup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2020 07:53 AM
Hi,
Ideally it should take to new form and not interceptor
If this setup is in your personal instance and you are ok to share details url and some admin credentials then share here -> ankurb.snow@gmail.com
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 08:06 AM