Assignment group for logged in user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 12:55 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 01:23 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 01:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 02:15 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 02:27 PM
it seems like it doesn't work with the syntax 'javascript:'.
When I removed it and hardcoded group sysids just for testing, it worked.