Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Advanced User Criteria for Catalog Item

mgraden
Tera Contributor

Trying to create an advance script for some catalog items to where it is available for users with customer Boolean field u_is_a_manage is true. It has yet to work for me. Is there something wrong with my script? 

 

answer();

function answer(){
   
var manager = gs.getUser().getRecord().getValue('u_is_a_manager');
        if (manager == 'true')
            {return true;}
        else
            {return false;}
}
2 REPLIES 2

Sneha KH
Giga Guru

Hello @mgraden ,

answer();

function answer() {
var user = new GlideRecord('sys_user');
if (user.get(gs.getUserID())) {
return user.getValue('u_is_a_manager') == '1';
}
return false;
}
Test it by opening User record and make sure u_is_a_manager = true (checked). Now Impersonate that user and open Service Catalog and test.

mgraden
Tera Contributor

Thanks for the reply, unfortunately that did not work. Below is a screenshot of how it looks on my end. Could I be missing something?