The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Assignment group for logged in user

miro2
Mega Sage

Hi,

I want to display only those groups in the 'Assignment group' field where the logged-in user is a member. I tried using the following script in the HR Template on HR Service, but it didn't work. 
 javascript:'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());

 

Does anyone have suggestions on how to display groups specific to the logged-in user in the 'Case Creation' section?

miro2_0-1693252257310.png

miro2_1-1693252399311.png

 

12 REPLIES 12

Tony Chatfield1
Kilo Patron

Hi, global.ArrayUtil().convertArray() converts an object to an array, but in this scenario you need a comma separated string, not an array, for this to function correctly.

If the data object returned directly by getMyGroups() is not interpreted\understood then you should be able to stringify it, as the resulting object is already a simple comma separated list already.

javascript:'sys_idIN' + gs.getUser().getMyGroups().toString();

Hi @Tony Chatfield1 thank for you reply
It might not work due to an existing reference qualifier.
I just found that the 'Assignment group' only displays specific types of HR groups based on that

miro2_0-1693254786479.png

 

If there is existing OOB ref qualifier then you will need to update\append the existing ref qual. but this should not be too difficult. Untested by try this, replacing X,Y,Z with the 'type' sys_id's shown in the OOB refqual

javascript:'active=true^typeINXXXXXXXXXXXXX,YYYYYYYYYYYYYYYYY,ZZZZZZZZZZZZZZZZZZZ^sys_idIN' + gs.getUser().getMyGroups().toString();

 

it seems like it doesn't work with the syntax 'javascript:'.
When I removed it and hardcoded group sysids just for testing, it worked.