Hide Catalog variables on RITM and CTask for all users except Requested users and Ceratain group

ChristopherF
Tera Contributor

Good morning all,

Please can someone advise the best approcah to fulfull above requirement and possible a simple script will suffice.

I work in a Security organisation hence the requirement to limit view of personal sensitive information to all including Admin team.

Note: Any one can submit the form in the Service Portal but Only allow backend field listview to Catalog item variable for thr following: the "requested_user", Assignment group "vetting"  and "Security_ access"  group

 

I will appreciate your response>

Regards

Chris

3 REPLIES 3

ChristopherF
Tera Contributor

Hello @Najmuddin Mohd 

Thanks for sending the link but its not applicable to my requirement because its not appropriate to create a new view for the RITM in my situation.

However, I created an Onload  Catalog Sclients Scripts to set variables to false for the Catalog item, which worked for the RITM and CTasks but I just need to apply conditional script to allow view for "requested_user", assignment group "vetting"  and "security_ access"  group.

 

Any help with this will be most appreciated.

 

Regards

Chris

 

ChristopherF
Tera Contributor

By the way i have resolved this issue using below OnLoad Client script which i will share below:

function onLoad() {
    //Type appropriate comment here, and begin script below
 
    var allowedGroups = ['SysID','SysID'];
    // Define sysID for assignment groups
var userSysId = g_user.userID;
    // List of variable names to hide/disable
    var variablesToRestrict = ['variable_1', 'variable_2'
    ];
 
    // If the user does not belong to the allowed groups, hide or disable the variables
 
    var now_GR = new GlideRecord('sys_user_grmember');
    now_GR.addQuery('group', 'IN', allowedGroups);
    now_GR.addQuery('user', userSysId);
    now_GR.query(response);
 
    function response(result) {
        if (result.next()) {
            for (var i = 0; i < variablesToRestrict.length; i++) {
                g_form.setDisplay(variablesToRestrict[i], true);
            }
        }else{
for (var i = 0; i < variablesToRestrict.length; i++) {
                g_form.setDisplay(variablesToRestrict[i], false);
            }
}
    }
}