- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 08:45 AM
I have created a UI Action on the sc_req_item table and added the same code that I found in the UI Action for the Problem table for Creating a Standard Change:
action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));
When this UI Action is clicked, it opens the list of all Standard Change templates. Upon selecting a template, a Change Request is created.
My Requirement:
I want the RITM (Requested Item) to be displayed in the Related Records section of the Change Request that is created from the Standard Change template.
I have implemented similar UI Actions for creating Normal Changes, where I use a different approach to link the RITM. However, that approach doesn't apply here, since this process first redirects to the Standard Change template selection page.
var change_id = changeRequest.insert();
current.parent = change_id;
current.u_change_request = change_id;
current.update();
Question:
Is there a way to implement this functionality so that the originating RITM is linked to the Change Request created via the Standard Change template?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 08:58 AM
try this
var url = new StdChangeUtils().getURLForTask(current, 'rfc');
url += '&ritm_sys_id=' + current.sys_id;
action.setRedirectURL(url);
then use onLoad client script and try to get ritm_sys_id from URL and set it in parent field on CHG
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 08:58 AM
try this
var url = new StdChangeUtils().getURLForTask(current, 'rfc');
url += '&ritm_sys_id=' + current.sys_id;
action.setRedirectURL(url);
then use onLoad client script and try to get ritm_sys_id from URL and set it in parent field on CHG
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 12:30 AM
Hi Ankur, Thanks for the response. I added this code and created an on load client script and then got the sys_id from URL and updated the parent field on CHG. It works.
However , my customer uses Service Operations Workspace. I need to implement it for SOW as well.
I've tried below things.
1. Added Below code in the workspace client script , but it wont work. It worked for 'Normal' and 'Emergency' UI Actions but not 'Standard' , i'm assuming its because we redirect to template page first..
function onClick(g_form) {
g_form.submit('action_name')
}
2. I found there was an OOB UI Action named - 'Create Change Request' which is present for the incident and problem tables both. I tried replicating same and created for the sc_req_item table.
UI Action Script
var target = {};
target.table = current.getTableName();
target.sysid = current.getUniqueValue();
target.field = 'rfc';
try {
target.isWorkspace = (typeof RP == 'undefined');
}
catch (err) {
target.isWorkspace = false;
}
gs.getSession().putProperty('change_link', target);
And Workspace Client Script :
function onClick(g_form) {
getMessages(['Create Change Request', 'Create', 'Cancel'], openInterceptorModal);
function openInterceptorModal(msg) {
var result = g_form.submit('create_std_change');
if (!result) {
return;
}
result.then(function() {
g_modal.sn_itsm_workspace.showInterceptor({
title: msg['Create Change Request'],
confirmTitle: msg['Create'],
cancelTitle: msg['Cancel'],
size:'sm',
height:'md',
params: {"modal": "false","target":"change_request"}})
.then(function(modalResult){
if (modalResult.data) {
if (modalResult.data.table != 'sc_cat_item')
g_aw.openRecord(modalResult.data.table, modalResult.data.sys_id, {query:modalResult.data.query});
else {
var ga = new GlideAjax('StdChangeUtils');
ga.addParam('sysparm_name', 'ajaxFunction_getCategory');
ga.getXMLAnswer(function (answer) {
if (answer) {
var params =modalResult.data.params;
params.sysparm_parent_table = "incident";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item', '-1', params);
}
});
}
}
});
});
}
}
I have correctly updated the Action name and the table name to 'sc_req_item' in the UI Action. But it works differently for RITM's.
When clicked from problem or incident - it opens up the below page
But when clicked from RITM - it opens up a modal - pop up and when i select standard change , it opens up the templates in portal instead of the above interceptor page.
This is not action assignment , its written in OOB UI Action only. But concern is how do i make it work for RITM table for SOW.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 12:33 AM
Thank you for marking my response as helpful.
I believe I answered your original question.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 01:25 AM
Hi Ankur,
For enabling the same in SOW which is the best approach that i should proceed with ?