Customized Edit Action in RITM Approvers Related(SOW) List Not Working After Australia Upgrade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We are experiencing an issue with a customized Edit Declarative Action in the Approvers related list on the Requested Item (RITM) in SOW after upgrading our ServiceNow instance to the Australia release.
The Edit functionality was customized using a Declarative Action with a Client Script to open the sys_m2m_template.do page and allow users to manage approvers.
The Client Script used in the Declarative Action is:
function onClick() { var _strLink = '/sys_m2m_template.do?' + 'sys_is_list=true&' + 'sys_is_related_list=true&' + 'sysparm_collectionID=' + g_form.getUniqueValue() + '&sysparm_query=' + '&sysparm_referring_url=' + location.pathname + '&sysparm_stack=no' + '&sys_target=sysapproval_approver' + '&sysparm_m2m_ref=sysapproval_approver' + '&sysparm_collection=sc_req_item' + '&sysparm_collection_key=sysapproval' + '&sysparm_collection_label=Approvers' + '&sysparm_collection_related_field=approver' + '&sysparm_collection_related_file=sys_user&'; var win = top.window.open(_strLink, '_self'); win.focus(); }
Issue
This customization was working as expected before the Australia upgrade.
After the upgrade:
- The customized Edit Declarative Action is displayed.
- Clicking the button does not execute the expected Client Script.
- The sys_m2m_template.do page/slushbucket does not open.
- No error message is displayed.
- The page remains unchanged.
As a basic test, we also replaced the Client Script with:
function onClick(g_form) { alert('Test action executed'); }
However, the alert is not triggered either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
if this was working fine before upgrade then raise a case with ServiceNow.
any browser console error?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar ,
Raised a case with ServiceNow; however, since this involves a customization, there are limitations on the level of support they can provide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
that's true.
don't use alert, try to use console.log() to debug
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
Hello @FemyM
Below declarative action works in both Zurich as well as in Austrailia. I have tried explaining the solution in the code comments:
function onClick(gForm) {
// extract sys_id of current ritm by splitting the current URL https://instance.service-now.com/now/sow/record/sc_req_item/aec79906.../params/...
var ritmSysId = '';
//not using g_form.getUniqueValue() because it doesn't work well with workspace
var urlParts = location.href.split('/sc_req_item/'); // Split URL at '/sc_req_item/' — everything after this is what we need.
// If the URL contains '/sc_req_item/', urlParts will have 2 pieces.
// The second piece starts with the sys_id, followed by '/' and other stuff.
if (urlParts.length > 1) {
ritmSysId = urlParts[1].split('/')[0]; // Take everything before the next '/' — that's just the sys_id
}
//if we somehow couldn't find the sys_id or user is on an unexpected page, stop here to avoid opening a broken slushbucket URL. Better to do nothing
if (!ritmSysId)
return;
// you are building below URL for
var slushbucketUrl = '/sys_m2m_template.do?' +
'sys_is_list=true&sys_is_related_list=true' +
'&sysparm_collectionID=' + ritmSysId + // RITM
'&sys_target=sysapproval_approver' +
'&sysparm_m2m_ref=sysapproval_approver' +
'&sysparm_collection=sc_req_item' +
'&sysparm_collection_key=sysapproval' +
'&sysparm_collection_label=Approvers' +
'&sysparm_collection_related_field=approver' +
'&sysparm_collection_related_file=sys_user' +
'&sysparm_stack=no';
// you are opening slushbucket in new tab using function declared below
openUrl(slushbucketUrl);
}
//Function: Opens a URL in a new browser tab
function openUrl(targetUrl) {
this.open(targetUrl, '_blank'); // not using top.window.open(url, '_self') because it doesn't work well with workspace
}
Validation Results:
Slushbucket to add remove members opened successfully in new tab:
Approvers added successfully:
Similarly, removed:
Hope that helps!
