Restrict case visibility based on confidential flag

dvelloriy
Kilo Sage

Hello Community,

 

We have enabled Procurement application recently.

There are cases assigned to few procurement groups (R1, R2, R3) which are sensitive and should be visible to just members of those groups.

OOTB, all procurement cases are visible to users with procurement agent role via read ACL.

 

Now Lets assume Case 1 is assigned to R1, 

Case 2 is assigned to R2

Case 3 is assigned to R3

Similarly Case 4, Case 5, Case 6 are assigned to other generic procurement groups.

 

If i am member of sensitive group R1. when i click on All procurement cases i should just see Case1, Case 4, Case 5, Case 6.

If i am member of both R1 and R2, i should see C1, C2, C4, C5, C6.

I tried creating a before query business rule, but its not working. Any help here would be appreciated.

 

(function executeRule(current, previous /*, example, additional */) {

    var userId = gs.getUserID();

    var assignmentGroup = current.assignment_group;

 

    // Add conditions to limit record visibility based on the 'confidential' field and assignment group

    var gr = new GlideRecord('sys_user_grmember');

    gr.addQuery('group', assignmentGroup);

    gr.addQuery('user', userId);

    gr.query();

 

    if (!gr.hasNext() && current.confidential) {

        // If the user is not a member of the assignment group and the case is confidential, restrict visibility

        current.setAbortAction(true);

    }

 

})(current, previous);

0 REPLIES 0