A work-around for setRedirectURL() in the Portal
The setRedirectURL() function does not work in the Portal, as documented here. If your page has a form widget for example, any redirects you built into you UI actions will fail - the portal just stays on the page after submission.
We've found a way to get around this restriction, by adding another widget to the page, which handles the submission event.
The only thing this widget needs is the following client controller code. It will grab the scope of the form and attach a function to the submission event. That function can then be used to take action based on the button that was pressed.
function() {
var c = this;
var formScope = $('#xfd1f4ec347730200ba13a5554ee4abcd').scope(); // The ID of the DOM element that holds the form. This should be the hashtag sign, then the letter 'x', then the sys_id of the Form widget (not the instance) that holds your record.
var gForm;
formScope.$on('spModel.gForm.initialized', function(e, gFormInstance) {
gForm = gFormInstance;
});
formScope.$on('sp.form.submitted', function (){
if (gForm.getActionName() == "sysverb_update"){ // This is the "Action name" of the UI Action
location.href = "?id=page1_id";
}
if (gForm.getActionName() == "other_action_name"){
location.href = "?id=page2_id";
}
});
}
Add that widget to a page that has the OOB "Form" widget, and you're good to go.
https://www.servicenow.com/community/now-platform-articles/a-work-around-for-setredirecturl-in-the-portal/ta-p/2297095