How i can check the requested for is a manager of any group in flow designer

Debasis Pati1
Tera Contributor

i have a catalog item for that i need to check if the requested for person is manager of any group or not according to that i will configure approvals.

 

How i can check if the requested for is a manager or not?

 

Regards,

Debasis

 

@Ankur Bawiskar can you suggest me here

2 ACCEPTED SOLUTIONS

Muhammad Khan
Mega Sage
Mega Sage

Flow trigger would be Service Catalog. Then use Look Up Record action and configure it something like below.

MuhammadKhan_0-1668775158522.png

 

View solution in original post

Check/True the check box Don't fail on error.

Look Up Record action | Docs Link

MuhammadKhan_0-1668787285661.png

 

Or use Look Up Records action.

When a Lookup Record can't find any records the flow results in an error  | KB Article Link

View solution in original post

5 REPLIES 5

Muhammad Khan
Mega Sage
Mega Sage

Flow trigger would be Service Catalog. Then use Look Up Record action and configure it something like below.

MuhammadKhan_0-1668775158522.png

 

Hi,

i have used it it works fine i have the requirement like if the requested for is a manger then only one level of approval is required else 2 levels of approvals.

Now if the user is a manger then it works fine but if the user is not a manager of any group then the look up record is throwing error and my below flow activities are not at all running

what should be done?

 

Regards,

Debasis

Check/True the check box Don't fail on error.

Look Up Record action | Docs Link

MuhammadKhan_0-1668787285661.png

 

Or use Look Up Records action.

When a Lookup Record can't find any records the flow results in an error  | KB Article Link

Ankur Bawiskar
Tera Patron
Tera Patron

@Debasis Pati1 

if you are using workflow then use IF activity with script

answer = ifScript();

function ifScript(){
	var manager = current.requested_for.manager;
	var gr = new GlideRecord("sys_user_group");
	gr.addQuery("manager", manager);
	gr.setLimit(1);
	gr.query();
	if (gr.hasNext()) 
		return 'yes';
	else
		return 'no';
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader