Redirecting to external website from UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 05:45 AM
Hi all. I'm trying to set an automatic redirect from a UI page to a site outside of our SNC instance.
The redirect URL will differ according to the parameters of the UI page.
The parameters are stored in the variable sysparm_number.
This is what I have tried, but I'm only getting a blank frame.
Can anyone help me figure out what's wrong.
Processing script of the UI Page:
redirectTo();
function redirectTo() {
var url;
if(jelly.sysparm_number==1){url="http://www.site1.com";}
else if(jelly.sysparm_number==2){url= "http://www.site2.com";}
else if(jelly.sysparm_number==3){url="http://www.site3.com";}
else if(jelly.sysparm_number==4){url="http://www.site4.com";}
response.sendRedirect(url);
}
-Tapio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 05:39 AM
Hi, window.location will not work because processing script is server side and not client side code.
I'm not sure you have access to Jelly variables within a processing script either.
What you'd need to do is create input fields (hidden fields) within the form on the page.
Give each one a name attribute and this will be submitted and now available to you on the processing script.
The name will then be a variable you can access on the processing script.
You can then redirect to the page.
For example on the UI page:
<input id="siteNumber" name="siteNumber" value="2" />
Then in the processing script:
var url = '';
if (siteNumber == '1') {
url = 'www.site1.com';
}
else if (siteNumber == '2') {
url = 'www.site1.com';
}
if (url) {
response.sendRedirect(url);
}
else {
response.sendRedirect('home.do');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 07:18 AM
Hi, I think i need to add a few more details about my case . My UI Page does not have any displayed elements on it in the normal use case. It's a survey page that I have modified to take the response as a parameter. The user is sent an email with links which provide the page all the data it needs, so the user will not have any controls on the ui page. I guess the Client script would be a better place to do the redirect them. Is there a way I can make the page redirect the user to the desired site after the page is done precessing it's code?
-BR
Tapio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 07:35 AM
Unfortunately not. Processing scripts are once it's submitted and client scripts no longer are utilised.
To do what you'd want, easiest thing you'd need tois edit the HTML of the UI page and add hidden fields on the form.
You might be able to do it using this:
Event.observe(window, 'beforeunload', doRedirect);
function doRedirect() {
alert('test');
//Do the redirect in here
}
Although i've never tried this before so not sure how well it'll work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 03:31 PM
Hi Ahmeid,
Are we able to add a link instead of number. i mean while click on the link below process script should run . something like that
please help me,