- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 04:54 AM
I am unable redirect to any URL using setRedirect in server side script of the widget i am working on. Can someone help on how can we do that or where is the issue.
Added the code snippets.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:08 AM
Hello @Amit Kumar21
Let me know if my understanding is wrong. In portal, in request item status page, you want to show a button/link on clicking of that button/link, user should be redirected to the catalog item page.
If yes, current solution is not good as it is making additional server call. updated solution below:
1. in server script, I can see you have the requestGr object which I am assuimg the GlideRecord object of the RITM record. You can save the sys_id of the catalog item in data object in server script as below:
data.cat_item_link = "?id=sc_cat_item&sys_id" + requestGr.getValue("cat_item");
2. in html, remove onclick attribute and update href as href='{{c.data.cat_item_link}}'
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:03 AM
Hi @Amit Kumar21,
Try with window.open() to open the URL in new tab or same tab.
Same tab:
window.open(baseURL, '_self');
New Tab:
window.open(baseURL, '_blank');
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:08 AM
Hello @Amit Kumar21
Let me know if my understanding is wrong. In portal, in request item status page, you want to show a button/link on clicking of that button/link, user should be redirected to the catalog item page.
If yes, current solution is not good as it is making additional server call. updated solution below:
1. in server script, I can see you have the requestGr object which I am assuimg the GlideRecord object of the RITM record. You can save the sys_id of the catalog item in data object in server script as below:
data.cat_item_link = "?id=sc_cat_item&sys_id" + requestGr.getValue("cat_item");
2. in html, remove onclick attribute and update href as href='{{c.data.cat_item_link}}'
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 10:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:04 AM
Hi,
In server script, input will not work in your code lines as you are not calling the server script from client side. Remove if condition. just get the RITM GlideRecord and get the catalog item sys_id from the GlideRecord and set in url.
Thanks,
Ali
Thank you,
Ali