
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2018 12:59 PM
Hey SN Comm!
I want to try something I believe is doable through client script but need some help with it.
I have 3 HR Services that are specific to Employee Relations Cases
- ER Report
- ER Administrative
- ER Union Grievance
Both 2 and 3, need to be available ONLY when someone within the Employee Relations Group is in the system creating their own Cases. Other than that, ER Report can be available all the time.
I was thinking of an onLoad client script (would need to be hitting the Case Creation Page), to only show ER Report when the user creating a new HR Case IS NOT in Employee Relations Assignment Group (or tie it to a role if need be).
Anyone able to work this out with me on how I could get this done? And, if i could do something other than client script?
Thanks to all in advance,
~Rob
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2018 04:25 PM
So the real pain I encountered was, this is a UI page. Even if you modify the reference qualifiers , you will only get it to work on a FORM, not on a UI page.
Achieved it using the Query Business rule on HR services table.
Assign a role to the specific users you want, in my example the role name is "XYZ".
Below is the script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(!gs.hasRole("XYZ"))//If the user doesnt have an XYZ role then exclude below HR Services
current.addEncodedQuery("name!=ER Administrative^name!=ER Union Grievance");
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2018 03:33 PM
What field type are these 3 options listed in? If it's a dropdown, you can do an onLoad client script and check their membership by doing:
if (gs.isInteractive() && !gs.getUser().isMemberOf('AG here')) {
// Remove the option they shouldn't see in the dropdown
g_form.removeOption('field_name_here', 'option_value_to_remove');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2018 05:44 AM
Hey Coleton,
Those three options come from a reference field on the sn_hr_core_case Table. I have definitely done your suggestion though, for a drop-down choice filed. That is where my head went first until I remembered that the HR Service field is a reference field to the core case table.
Thank you for the suggestion though!
~Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2018 11:52 AM
I would go to the variable under the tab 'Type Specifications' > 'Use reference Qualifier' > 'Advanced', and call a Script Include which would do the filtering for me.
To call the script include in the advanced reference qualifier:
javascript:ScriptIncludeGoesHere()
This should resolve your question and if it does, please mark this as correct.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2018 12:03 PM
Hey Coleton,
Are you saying that I should do all this within the Dictionary Entry for the HR Service reference field? If so, this is what we currently have for it:
If this is what you are referring to, am I able to add your suggestion to what we already have going on here?
Thanks,
~Rob