gs.setRedirect is not working in portal widget server side script

Amit Kumar21
Tera Contributor

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.

1 ACCEPTED SOLUTION

Ahmmed Ali
Giga Sage

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

 

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

5 REPLIES 5

Not applicable

Hello @Amit Kumar21 

 

Use action.setRedirectURL('')

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh