Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need give the read access for project manager of the demand

Sanjeeva Nagend
Tera Contributor

Hi Every one,

 

I have a requirement, Need to give the read access for Selected project manager on the demand form. I have created before Query business rule but its not working.

 

var logged_user = gs.getUserID();   
if(gs.getUser().isMemberOf('aacb62e2c0a80015007f67f752c2b12c')){
        current.addQuery('current.project_manager', logged_user);
 
}
 
Please check this script where is it wrong.
1 REPLY 1

Amit Verma
Kilo Patron
Kilo Patron

Hi @Sanjeeva Nagend 

 

Please try with below script :

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

    var logged_user = gs.getUserID();
    if (gs.getUser().isMemberOf('aacb62e2c0a80015007f67f752c2b12c')) {
        current.addQuery('project_manager', logged_user); // Assuming that the field name is project_manager
    }

})(current, previous);

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.