The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Redirecting to external URL from script include

chrisn_
Mega Guru

Hello everyone,

I have created a scoped application that feeds into a third party application via an API Rest Call. After the initial call is complete the requirements I am working with state they want the user to be redirected to an outside URL that will end with a unique value they will send me in the initial API calls response. I am getting this value and entering it on the record so it is usable. The problem I am having is that the redirect straight from the record producer is too fast. I can't seem to delay it for 3 seconds so that the third party can return the value I need so the link in the redirect will work. I am now trying a script include that looks like this:

var MyGlobalScopeUtils = Class.create();
MyGlobalScopeUtils.prototype = {
initialize: function() {
},
sleep: function (duration) {
gs.sleep(duration);
},

type: 'MyGlobalScopeUtils'
};

 

In my record producer I have this script:

var globalUtils = new global.MyGlobalScopeUtils();
globalUtils.sleep(5000);

producer.redirect="https://service/exams/${current.x_unoci_rapid_retu_cover_sheet_link}";

Since I have put the first two lines in the redirect no longer works. Is there something I can do to fix this from the record producer or is there a way I can handle this redirect from the script include?

6 REPLIES 6

Thank you for your help Stephen, Unfortunately I was not able to get this to work as I wanted, but I was able to find an alternative way to do this via a business rule instead. Thank you for your time and help!

Are you able to show how your BR redirects a user to an external site?

Thanks,

-Rob