Hide HR services to all users when creating a case in the backend

Community Alums
Not applicable

Is it possible to use HR Criteria to hide some HR Services in the backend when creating a ticket/case? I saw some recommendations to use a query BR but I'm still wondering if it's possible to utilize HR Criteria to hide specific HR services.

1 ACCEPTED SOLUTION

Rob Sestito
Mega Sage

Hello @Community Alums - 

Are you looking to hide the cases once they are created, between hr groups?

For example: once the hr payroll team creates a case using Payroll Discrepancy hr service, now no other group can see that case.

 

If that is what you are looking to do, then I would suggest using CoE Security Configuration(s). You could create a Read and a Write CoE Security record to look something like this:

 

RobSestito_0-1717506388271.png

 

Here I am signed in as an HR Agent that is in the HR Benefits assignment group, and I cannot see a payroll case:

RobSestito_1-1717506786888.png

 

Here I am signed in as an HR Agent that is in the HR Payroll assignment group, and I can see the payroll case:

RobSestito_2-1717506874355.png

 

However, IF you are looking to hide services before the case is created, as in being hidden when the agent is creating a case from the Case Creation Page. Then yes, you would need to create something else, like a business rule to remove those options based on the signed in user.

 

If you needed to hide a service like this, then the BR would need to be a query type for When to Run:

RobSestito_3-1717509228133.png

(function executeRule(current, previous /*null when async*/ ) {
    // Get the current logged-in user
    var userId = gs.getUserID();

    // Check if the user is in the HR Payroll group
    var isPayrollTeam = false;
    var gr = new GlideRecord('sys_user_grmember');
    gr.addQuery('user', userId);
    gr.addJoinQuery('sys_user_group', 'group', 'sys_id')
        .addCondition('name', 'HR Payroll');
    gr.query();
    if (gr.next()) {
        isPayrollTeam = true;
    }

    // If the user is not in the HR Payroll team, filter out the 'Payroll Discrepancy' service
    if (!isPayrollTeam) {
        // Add a query condition to exclude the 'Payroll Discrepancy' service
        current.addQuery('name', '!=', 'Payroll Discrepancy');
    }
})(current, previous);

 

Here I am as a person in the HR Payroll Group:

RobSestito_4-1717509302128.png

 

Here I am as someone NOT in the HR Payroll Group:

RobSestito_5-1717509356892.png

 

You can see that the normal Payroll Discrepancy is missing, but the alumni is still there of course.

Please remember this is all built on me using this one service as an example.


So, based on which direction you are looking for;

  • Hide HR Service(s) before case is created, you could use a query business rule
  • Hide HR Service(s) after case is created, you could use CoE Security Configuration

I hope this helps you out!

Please keep us posted if you need additional help or run into issues.

 

Cheers,

-Rob

 

 

 

View solution in original post

3 REPLIES 3

Rob Sestito
Mega Sage

Hello @Community Alums - 

Are you looking to hide the cases once they are created, between hr groups?

For example: once the hr payroll team creates a case using Payroll Discrepancy hr service, now no other group can see that case.

 

If that is what you are looking to do, then I would suggest using CoE Security Configuration(s). You could create a Read and a Write CoE Security record to look something like this:

 

RobSestito_0-1717506388271.png

 

Here I am signed in as an HR Agent that is in the HR Benefits assignment group, and I cannot see a payroll case:

RobSestito_1-1717506786888.png

 

Here I am signed in as an HR Agent that is in the HR Payroll assignment group, and I can see the payroll case:

RobSestito_2-1717506874355.png

 

However, IF you are looking to hide services before the case is created, as in being hidden when the agent is creating a case from the Case Creation Page. Then yes, you would need to create something else, like a business rule to remove those options based on the signed in user.

 

If you needed to hide a service like this, then the BR would need to be a query type for When to Run:

RobSestito_3-1717509228133.png

(function executeRule(current, previous /*null when async*/ ) {
    // Get the current logged-in user
    var userId = gs.getUserID();

    // Check if the user is in the HR Payroll group
    var isPayrollTeam = false;
    var gr = new GlideRecord('sys_user_grmember');
    gr.addQuery('user', userId);
    gr.addJoinQuery('sys_user_group', 'group', 'sys_id')
        .addCondition('name', 'HR Payroll');
    gr.query();
    if (gr.next()) {
        isPayrollTeam = true;
    }

    // If the user is not in the HR Payroll team, filter out the 'Payroll Discrepancy' service
    if (!isPayrollTeam) {
        // Add a query condition to exclude the 'Payroll Discrepancy' service
        current.addQuery('name', '!=', 'Payroll Discrepancy');
    }
})(current, previous);

 

Here I am as a person in the HR Payroll Group:

RobSestito_4-1717509302128.png

 

Here I am as someone NOT in the HR Payroll Group:

RobSestito_5-1717509356892.png

 

You can see that the normal Payroll Discrepancy is missing, but the alumni is still there of course.

Please remember this is all built on me using this one service as an example.


So, based on which direction you are looking for;

  • Hide HR Service(s) before case is created, you could use a query business rule
  • Hide HR Service(s) after case is created, you could use CoE Security Configuration

I hope this helps you out!

Please keep us posted if you need additional help or run into issues.

 

Cheers,

-Rob

 

 

 

Community Alums
Not applicable

Thanks Rob! This clarified everything to me.

 

Awesome - glad I was able to help you out!

 

Take care,

-Rob