- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 02:00 AM
Dear Community,
I'm using an UI action button in the Agent view ("Create Emergency Case") that creates a case. Finally the UI Action uses a redirect:
var url = '/nav_to.do?uri=sn_customerservice_case.do?sys_id='+ newCaseSysId;
action.setRedirectURL(url);
that redirects to the new case. This works fine.
But now I have the requirement that a certain action (prefilling comment field) is only be done in the case form (after redirect) when the case is just created during the UI action. This action should not be done when opening the case using any other usual way.
So I tried to add a parameter to the url: newEmergencyCase=true which can be read from the client script. This works when I add the parameter manually.
I tried to add it to the redirect:
var url = '/nav_to.do?uri=sn_customerservice_case.do?sys_id=' + newCaseSysId + '&newEmergencyCase=true';
But, obviously action.setRedirectURL(url); removes the additional parameter. So I tried:
var url = '/nav_to.do?uri=sn_customerservice_case.do?sys_id=' + newCaseSysId + '?newEmergencyCase=true';
or
var url = '/nav_to.do?uri='+ encodeURIComponent('sn_customerservice_case.do?sys_id=' + newCaseSysId + '?newEmergencyCase=true');
both failed as the URL ends with
...sn_customerservice_case/d515458cc390e21091d56110a00131e8%3FnewEmergencyCase%3Dtrue
and so the "Record not found" due to the Sys_ID seems to be d515458cc390e21091d56110a00131e8%3FnewEmergencyCase%3Dtrue and not only d515458cc390e21091d56110a00131e8.
So my question is:
How do I add a custom parameter to the URL that I can read in the client script like this: ...sn_customerservice_case/d515458cc390e21091d56110a00131e8?newEmergencyCase=true
or:
is there another way to tell the client script when it was called using the UI action?
Thanks
Sirko
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 03:17 AM - edited 03-20-2025 03:35 AM
why not move the code to client side and then use window.open and then include URL parameter and fetch it using onLoad
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
03-20-2025 03:17 AM - edited 03-20-2025 03:35 AM
why not move the code to client side and then use window.open and then include URL parameter and fetch it using onLoad
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
03-20-2025 08:06 AM
Yes, this is a working way, thanks
Sirko