how to check the manager

Sandaru1
Tera Expert

Hi,

I need to check the current requester is a manager or not. how can i do that in a script. my complete logic would be like follow.

current_user = requesting user

requested_for_user = value of "requested for" field of request

if(manager of requested_for_user == current_user )

{

return 'yes'

}

else

{

return 'no'

}

please let me know a correct way to do this.

Thanks

/Sandaru

6 REPLIES 6

Hi Santoshsahoonis,

     I have the same type of request. I want to accomplish this via a Catalog Client Script.

I have a form that has an amount field that should be hidden from everyone except those that have a specific role or the requester or the manager of the requester. How can i accomplish this thru my Catalog Client Script please.

find_real_file.png

preddy
Kilo Guru

Hi ,



I think below code is helpful for you.



var hasRole = g_user.hasRoles();


      var selfUser = (g_form.getValue('requested_for') == g_user.userID);


      if(hasRole || selfUser){


             


              var requestor = g_form.getReference('requested_for');


              g_form.setValue('line_manager',requestor.manager);


       


          }



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.