Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Redirect to External URL in Business rule

chrisn_
Mega Guru

I am attempting to redirect to an external url after a user submits a record and a particular field is filled with a unique value. I need to take that unique value, plug it on the end of a static url and then redirect to it. example is 

https://iwantmystuff/service/{unique value}. I believe what I need to do is define the url using something like

var url = gs.generateURL  and then gs.setRedirect(url); but I am not utilizing this correctly as I am commenting out most of the code due to the // in the first line. I am obviously making a rookie error I don't realize. Can someone please help me craft this correct? The unique value is coming from a scoped application that is open to global scripts so this should be accessible. Do I also need to do a separate call for that unique value's value? To those who stop by, thank you very much for your time!

1 ACCEPTED SOLUTION

DScroggins
Kilo Sage

Hello please try the following:

var mainURL = 'https://iwantmystuff/service/';

var urlFinal = mainURL + current.FIELD_NAME.toString(); //Replace with your form field

gs.setRedirect(urlFinal);

 

--David

View solution in original post

12 REPLIES 12

Thanks David, I will try this once. 

 

Regards,

Priya.

Hi David,

I have couple of variables but only need to redirect number to the demand task(on service portal). could you please suggest if this is achievable?

thanks worked