- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-07-2019 09:02 AM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-07-2019 09:14 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2020 07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-12-2020 12:46 AM
Hi David,
Thank you for the response.
Can we restrict only that catalog form by using URL and variable sysid..
Thank you,
Priya.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-12-2020 09:42 AM
I suppose you can try using gs.getUrlOnStack() to check the current URL and then check if the sys id of the catalog item is present or not. If it is then you can exclude the addActiveQuery condition. Something like so:
var curURL = gs.getUrlOnStack();
var itemID = SYS_ID // Replace with Sys ID of your catalog item
var n = curURL.search(itemID);
if(n < 0){
current.addActiveQuery();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2020 01:37 AM
Hi David,
Thanks for your suggestion.
Can we add variable sys_id as well to the script to be more specific.
Thank you,
Priya.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2020 11:05 AM
No you cannot. You can only identify what is in the URL and variable sys id isn't included in the URL.