The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Allow user with certain role to Update an incident assigned to specific assignment group.

Cindy Sim
Tera Expert

I have created Custom Role "update_a". I need to allow only users with this role to update incident assigned to assignment group "B".  I am trying to use business rules for this. Any Suggestions how can I achieve this. 

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @Cindy Sim ,

Create write ACL on incident record and write code in script section to check following conditions.

1) logged in user has role "update_a"

2) current record's (i.e. incident) assignment group is "B"

 

// Check if user has role 'uupdate_a' and assignment_group is 'B'
gs.hasRole('update_a') && current.assignment_group.name == 'B';

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Rafael Batistot
Kilo Patron

Hi @Cindy Sim 

May you try via Client script > onSubmit

function onSubmit() {
    var groupName = g_form.getDisplayValue('assignment_group');

    if (groupName === 'B') {
        var hasRole = g_user.hasRole('update_a');

        if (!hasRole) {
            g_form.addErrorMessage("You are not allowed to update incidents assigned to group B."); //optional
            return false; // Not allow submit
        }
    }

    return true; // Allow submit
}