action.setRedirectURL(); function not working in UI action

NaveenB44866094
Tera Contributor

I am trying to redirect URL to a Service Portal page, but i can't able to do that.

current.approval_status = "approved";
    current.update();
    var url = "https://sarvatrdev.service-now.com/cgn";
    action.setRedirectURL(url);
4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@NaveenB44866094 

what type of UI action is this?

It should be server side.

Share complete script and UI action configuration screenshots.

Where are you running this? native or from portal form or from workspace

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I created two server-side UI actions configured to redirect to a Service Portal page. They work as expected in the native view but not in the Service Portal view.

Naveenbabu1531_0-1739189566517.pngApprove UI Action

Naveenbabu1531_1-1739189594351.pngReject UI Action

 

 

var url = "https://sarvatrdev.service-now.com/cgn";
action.setRedirectURL(url);

 

I need the action to be performed in service portal, but it is not redirecting

Naveenbabu1531_2-1739189753875.png

 

@Naveenbabu1531 

action.setRedirectURL doesn't work in portal side; there is a KB for this

action.setRedirectURL(url) does not work in UI Action for Service Portal 

check this link for workaround

A work-around for setRedirectURL() in the Portal 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 
I created two server-side UI actions configured to redirect to a Service Portal page. They work as expected in the native view but not in the Service Portal view.

Naveenbabu1531_0-1739190684467.png

var url = "https://abc.service-now.com/cgn";
action.setRedirectURL(url);