Module Link Type - Script (From Arguments) Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2013 08:09 AM
I am looking to create complete unique overview pages based on the person's assignment group, I got the idea from this post: Adding external link to Module
However, I am having an issue that when I add any script to the module I create it gives an error. Not sure what is going on, so I attached a picture in hopes someone knows the answer.
Right now I am just using javascript:window.open("http://www.google.com"); as the code in the Arguments area and it still errors out.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2013 10:27 AM
People were using URL and not Script. I needed something a bit more specific, so I created a script:
var usr = gs.getUserID();
var aUser = new GlideRecord('sys_user');
var overviewPage = '';
aUser.addQuery('sys_id', usr);
aUser.query();
if (aUser.next()) {
overviewPage = '?sysparm_view='+aUser.u_default_assignment_group.u_overview_page;
}
var redirectURL = '/home.do'+overviewPage;
gs.print('<a href="'+redirectURL+'">Click here if you are not automatically redirected...</a>'+
'<script>document.location.href = "'+redirectURL+'"</script>');
This will automatically redirect users to their custom Overview page based on their Default Assignment Group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2014 09:51 PM
Hi Chris,
The above post was very helpful in building certain functionality which I needed for a custom application. It worked very succesfully in our Prod instance (Calgary). We've just upgraded our Dev environment to Eureka and the functionality no longer works. It now just prints the gs.print line, rather than actually redirecting.
Have you upgrade to Eureka as of yet? If so did you have the same issues?
Thanks
- Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2015 06:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 08:43 AM
In case someone is looking for a solution for this in newer versions, there are at least two :
- create a "HTML (from arguments)" module that builds the link with a client <script> (no gs)
- closer to Christopher's redirect solution, create a custom UI Page that builds the query in Jelly and redirects the client to this URL; change the module itself so that it points to this UI Page with type : URL (from arguments)
HTH
