Client script to redirect in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 11:01 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 11:14 AM
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
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