Dynamic redirection on module click in Jakarta?

Ravish Shetty
Tera Guru

We are on Geneva and have a requirement to re direct users to different URL's based on their user profile.

When they click on the module 'Service Catalog', users belonging to set A must redirect to catalog homepage and set B should be redirected to the CMS site.

Right now we are using Global UI script to manipulate the DOM of the 'Service catalog' module to achieve this but we want to discontinue the DOM manipulation as it doesnt work perfectly and sometimes users arent redirected correctly.   Also, ServiceNow discourages DOM manipulation.

We would go with the UI page option as suggested here: How to redirect on Module Script from Arguments?

but we would like to know if there is a feature in Jakarta which we can leverage.

Related question by me: Dynamic redirection on module click

3 REPLIES 3

dhasselquist
Mega Guru

If they can have unique groups or roles, then it would be a lot easier to just have two different modules under the application.



Could you expand a little more on the use case?


The CMS site that we have is a fancy version of the service catalogs that users see.


Some users prefer to use the CMS site to submit requests.   Their preference is stored in their user profile.   It is a drop down field with 2 values.


Users are free to change their preference by changing it in their user profile.


The redirection should happen based on this user profile value.


I read a few of the responses in the links you posted, and was able to mock up what I think you're after.



1. System Property


I called mine "community.test" (referenced in line 7 below), you'll switch out for whatever yours is + the value



2. New UI Page, called CommunityRedirect:


HTML:


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


Redirecting...


<g:evaluate jelly="true">


var userPref;


//In my mockup I used community.test as my system property


if (gs.getUser().getPreference('community.test') == 'cms')


userPref = 'ess';


else


userPref = 'etc';


</g:evaluate>


</j:jelly>



Client Script:


window.location = '${userPref}';



3. New Module - URL (From Arguments:)


./CommunityRedirect.do



This will take the user to the UI page, which will check their user preference and send them to the URL of your choosing. You may want to spruce up what the UI page looks like, maybe something to the effect of "We're sending you to your preferred catalog view".