how to check the manager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2017 01:27 AM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2018 08:21 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2017 01:59 AM
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.