Permissions to view templates regardless of Assignment Group

LaraReddy
Tera Guru

Hiii,

Can anyone please help us how to provide the access to view all incident templates to one particular user??

Currently user is able to see only his group templates.

Thanks,
LARA 

1 ACCEPTED SOLUTION

Hi @LaraReddy 

Certainly, we need the ACL to provide access to the record initially.

Regarding the OOTB business rule, customization is required.

Below is for the requirement custom role [temp_access] user able to see only incident related templates.

(function executeRule(current, previous /*null when async*/ ) {

    if (gs.hasRole("temp_access")) {
        current.addEncodedQuery('table=incident');
        return;
    }
    roTemplates();

})(current, previous);


function roTemplates() {
    var query = "global=true^ORuser=" + gs.getUserID() + "^ORgroups=javascript:gs.getUser().getMyGroups()";
    current.addEncodedQuery(query);
}

 

If you want to grant access to all templates in the Incident table and also allow users to access templates shared with them, use the adjusted code below:

(function executeRule(current, previous /*null when async*/ ) {

    roTemplates();

})(current, previous);


function roTemplates() {
    var query = "global=true^ORuser=" + gs.getUserID() + "^ORgroups=javascript:gs.getUser().getMyGroups()";
    if (gs.hasRole("temp_access")) {
        query += '^ORtable=incident';
    }
    current.addEncodedQuery(query);
}

 

Cheers,

Tai Vu

View solution in original post

6 REPLIES 6

Hi @LaraReddy 

Certainly, we need the ACL to provide access to the record initially.

Regarding the OOTB business rule, customization is required.

Below is for the requirement custom role [temp_access] user able to see only incident related templates.

(function executeRule(current, previous /*null when async*/ ) {

    if (gs.hasRole("temp_access")) {
        current.addEncodedQuery('table=incident');
        return;
    }
    roTemplates();

})(current, previous);


function roTemplates() {
    var query = "global=true^ORuser=" + gs.getUserID() + "^ORgroups=javascript:gs.getUser().getMyGroups()";
    current.addEncodedQuery(query);
}

 

If you want to grant access to all templates in the Incident table and also allow users to access templates shared with them, use the adjusted code below:

(function executeRule(current, previous /*null when async*/ ) {

    roTemplates();

})(current, previous);


function roTemplates() {
    var query = "global=true^ORuser=" + gs.getUserID() + "^ORgroups=javascript:gs.getUser().getMyGroups()";
    if (gs.hasRole("temp_access")) {
        query += '^ORtable=incident';
    }
    current.addEncodedQuery(query);
}

 

Cheers,

Tai Vu

Thanks, Tai, for your support.