- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 12:09 PM
Hi Team,
I wanted to pass dynamic URL in gs.setRedirect(URL). URL should contain dynamic instance URL, so it will not impact the functionality when code will be pushed to higher instances. I'm using gs.setRedirect(URL) inside script include. I tried using action.setRedirectURL(gr) but it's not refreshing the page and user are still able to modify some fields.
some code mentioned in script include:
var change = new GlideRecord('change_request');
change.get('sys_id');
change.state = '4';
change.u_close_code = 'Change cancelled';
change.update();
action.setRedirectURL(change);OR gs.setRedirect(URL)//here I wanted to redirect to same record.
Please advice
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 11:49 PM
Hey patSnow,
Refer the thread, it might help you:
Mark correct and helpful if it resolves your issue!!!
Best Regards,
Namrata.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 12:27 PM
As you are using a Script Include, try using:
var urlOnStack = gs.getUrlOnStack();
response.sendRedirect(urlOnStack);
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 11:40 PM
try this,
gs.setReturn(current.getLink(true));
gs.setReturn(current.getLink());
gs.setRedirect(current.getLink(true));
gs.setRedirect(current.getLink());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 11:49 PM
Hey patSnow,
Refer the thread, it might help you:
Mark correct and helpful if it resolves your issue!!!
Best Regards,
Namrata.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2020 12:52 AM
As per your script you are not using any hard-coded instance name in the script
I assume you are using this code in UI action. If yes then gs object won't work for redirection
you should use action object
Please let us know what is the exact scenario and what is not working
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
