We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Need to check if the requester is manager is true or false

Haresh Haru
Tera Expert

Hi All,

I have created the workflow in that we have to check logged in user(requester) "is manager" check box is true or false , if the requester "is manager" is true then we don't need approval, if the requester "is manager" check box is false that need approval so I have added the activity is "if" condition in that I have write the script..

 

Regards,

Haresh 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron

Hi,

Try this

 

var records = new GlideRecord('sys_user');
	records.addQuery('manager', gs.getUserID());
	records.addActiveQuery();
	records.setLimit(1);
	records.query();
	if (records.next()) {
		return true;
	}
return false;

 

-Anurag

View solution in original post

2 REPLIES 2

Anurag Tripathi
Mega Patron

Hi,

Try this

 

var records = new GlideRecord('sys_user');
	records.addQuery('manager', gs.getUserID());
	records.addActiveQuery();
	records.setLimit(1);
	records.query();
	if (records.next()) {
		return true;
	}
return false;

 

-Anurag

maroon_byte
Mega Sage

So what is the question here?