Hiding HR Services from Section

Rob Sestito
Mega Sage

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

  1. ER Report
  2. ER Administrative
  3. 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

1 ACCEPTED SOLUTION

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".

 

find_real_file.png

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);

View solution in original post

16 REPLIES 16

Yeah, you can add a semicolon to the end of that Reference Qualifier statement, and just throw the script include function call after the existing statement.

find_real_file.png

ARG645
Tera Guru

Rob,

I have a question, when users create a HR case, are they going through the UI page sn_hr_core_case_creation.do 

find_real_file.png

 

If yes, then I believe writing a client script wont work. We have to comeup with something else.

 

-Aman Gurram

Hey Aman,

Yes, that is the UI Page being used in order to start the Case creation is the sn_hr_core_case_creation.do. If this will cause a client script to not work, what do you suggest?

Thanks,

~Rob

As of now, I am not sure how to handle this. 

I tried many things, like ACL's and all and I did not achieve anything. 

Try the suggestion provided by invisible user below.

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".

 

find_real_file.png

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);