Client script to redirect in Service Portal

gregrice
Tera Expert

I have written a UI action to duplicate a record and would like to redirect to the new record in the Service Portal. I know the action.setReturnURL will not work in the portal. I know the $window is not available. I have read that top.window.location.href is what I should use. It doesn't work either.

Below is a snip it of the UI action code. And a screen shot of the error message I am getting. (I cannot figure out how to redirect the SP using a client script).

 

gs.addInfoMessage(url);
	gs.addInfoMessage("New Travel Request - " + current.number + "has been created. Please navigate to this record to complete");
	top.window.location = url;
    //action.setReturnURL(url);

ERROR Message

find_real_file.png

1 REPLY 1

Pranav Bhagat
Kilo Sage

Hi

 

You have to use the client UI Action ,to do that check the client button and then add the on click function .

Try this

find_real_file.png

 

Or 

if you want to redirect to same record

 

function test(){
var url = '/sp?id=ticket&table=incident&sys_id=' +g_form.getUniqueValue();
window.open(url,'_blank');
g_form.save();
}

 

Regards

Pranav