Linking 2 RITM raised by 2 separate catalogs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2025 04:23 AM
We have below requirement in our instance-
We have 2 catalog items ABC and XYZ , XYZ catalog is called using scratchpad method in first catalog ABC (ie. ABC is Primary catalog and XYZ is Secondary catalog )....I have to link 2 RITM raised by this 2 catalogs....When state of First RITM (ABC catalog) is changed to "approved" then state of Second RITM (XYZ) should be chnaged to "approved". Similarly if state of first RITM is changed to "Rejected" then State of second RITM should be changed to "Rejected"
state
RITM1 = "Approved" then RITM2= "Approved"
RITM1 = "Rejected" then RITM2= "Rejected"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2025 04:38 AM
Hi @VaibhavM ,
Are you raising 2nd ritm once first got created? Do you have any attributes which tell that both ritm are related to each other. If not then make primary ritm parent or XYZ. now write BR to update the state when state got change from parent one.
if (current.parent.nil()) {
return;
}
var gr = new GlideRecord('sc_req_item');
gr.addQuery('parent', current.sys_id);
gr.query();
while (gr.next()) {
// Update the state of the related RITMs
gr.state = current.state;
gr.update();
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2025 04:55 AM
Hi @Runjay Patel second RITM is raised automatically due to scratchpad method used in end of first catalogs workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2025 05:00 AM
Hi @VaibhavM ,
Use revised script it will work.
if (current.u_reference_ritm.nil()) {
return;
}
var gr = new GlideRecord('sc_req_item');
gr.addQuery('u_reference_ritm', current.sys_id);
gr.query();
while (gr.next()) {
// Update the state of the related RITMs
gr.state = current.state;
gr.update();
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2025 12:48 AM
Hi @VaibhavM ,
Did the solution worked?
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------