- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 09:24 AM
Hi I am not able call script include from module link type - URL (from arguments)
when I do a JavaScript call in module nothing happens
javascript: new script include name().function name();
I want to redirect user to different portal pages based on users country
script include return the correct URL based on the users country
Regards,
Rajashekar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 10:45 AM
Hi,
It is not possible to call script include in argument field of Modules. That field just store the argument.
But to achieve similar requirement we have implemented redirection as given below:
1. create a UI Page 'sp_redirect.do'
2. Create a UI macro 'sp_redirect_macro' which is referred in UI Page
3. And update your module like with UI Page name.
Below is the UI macro script for your reference:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_country" object="true">
var userGr=new GlideRecord('sys_user');
userGr.get(gs.getUserID());
var countrycode = userGr.getDisplayValue('country');
countrycode;
</g:evaluate>
<g:evaluate var="jvar_portal" object="true" >
var instUrl = gs.getProperty('glide.servlet.uri');
instUrl;
</g:evaluate>
<script >
var sp;
var userCountry = "${jvar_country}";
var url = "${jvar_portal}";
if(userCountry== 'Brazil'){ //for brazil use different portal
sp = 'spbr';
}else{
sp = 'sp';
}
window.location = url + sp;
</script>
</j:jelly>
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 09:27 AM
Please try to print the URL in background script.
javascript: new script include name().function name(); and share the screenshot?
Thanks and Regards,
Saurabh Gupta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 10:45 AM
Hi,
It is not possible to call script include in argument field of Modules. That field just store the argument.
But to achieve similar requirement we have implemented redirection as given below:
1. create a UI Page 'sp_redirect.do'
2. Create a UI macro 'sp_redirect_macro' which is referred in UI Page
3. And update your module like with UI Page name.
Below is the UI macro script for your reference:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_country" object="true">
var userGr=new GlideRecord('sys_user');
userGr.get(gs.getUserID());
var countrycode = userGr.getDisplayValue('country');
countrycode;
</g:evaluate>
<g:evaluate var="jvar_portal" object="true" >
var instUrl = gs.getProperty('glide.servlet.uri');
instUrl;
</g:evaluate>
<script >
var sp;
var userCountry = "${jvar_country}";
var url = "${jvar_portal}";
if(userCountry== 'Brazil'){ //for brazil use different portal
sp = 'spbr';
}else{
sp = 'sp';
}
window.location = url + sp;
</script>
</j:jelly>
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 10:57 AM
Hi Anil Lande,
Thankyou for the reply,
I have tried many ways, nothing was working
but what you had suggested works perfectly.
I am only facing one issue in the UI macro script my code is not going inside the if condition
it is by default taking the else condition
only change I have done is in place of country I have used domain condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2021 11:15 AM
Hi Anil Lande,
Thankyou for your reply,
This works perfectly as expected and thankyou for your time you have taken write all the code.
Regards,
Rajashekar