cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
solwebsolutions
Frequent Visitor

Find employees first vice president instance

Is there a way to use FLOW to take the person that submitted an approval workflow and find the first vice president by looking in Azure AD?  We have a requirement to have VP approval of travel requests, and whomever submits the request we'd like to go up the organization chain to find the first VP of that person's group/organization.

9 REPLIES 9
cwebb365
Super User
Super User

So, just off top of my head. 

Set variable for Title, and Manager of submitting user. Then use a Do until loop and set it to run until the Title variable Contains VP? OR Vice President assuming they all contain that in their title. 

 

Then in that loop,  set the variable of the current variable manager and title of the previous step. So basically this will check for VP of who's in the variable, then in the loop add in that persons manager, check for VP, get that person's manager and so on until it get's a VP match. Then You should be able to now use the variable outside that loop when it's true, to do the rest of your approval process. 

 

You'll also want to probably come up with some kind of loop protection logic, like if Title is null, or if you reach the CEO then stop etc. 

Thank you...any example of such a loop?  We're just starting on Flow

v-bacao-msft
Community Support
Community Support

Hi @solwebsolutions,

 

Could you provide more details about "the first vice president by looking in Azure AD"?

Please provide more details about your requirements and we would provide a proper workaround for you.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi!

 

If a person from group A submits a travel request, there is a VP for that group, and we'd need to go up to ORG chain to find the first employee with the title VP who'd get the approval.  If person from Group B submits a travel request as well, they would have a different VP for their group, and we'd need to go up the organization chain to find the first employee with the VP title who would be responsible for approving/denying travel.

Hi...is this more of something for PowerApps? 

 

In PowerApps looks like there's a "Get Manager" function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users

 

...but nothing for "Find VP" or etc.  I'm seeing a Connectors option that does 'Search for Users':

https://docs.microsoft.com/en-us/connectors/office365users/#search-for-users

 

I was looking at the Azure AD actions in Flow, and I see:

1. Azure AD

2. HTTP with Azure AD

 

...but, the available actions to build out my flow don't talk about anything Manager or organization.

Would we have to use 'Get web resource' or 'Invoke and HTTP request' associated with the category "HTTP with Azure AD"?

Getting a little closer.

If I use my name in a simple PowerApp textbox and put my manager's name in another textbox called "TextInput1":

Office365Users.Manager(TextInput1.Text).DisplayName

...I can also pull the manager's title by:

Office365Users.Manager(TextInput1.Text).JobTitle

 

I can go up one level to my manager's manager by doing an easy wrap of the Office365Users.Manager function:

Office365Users.Manager(Office365Users.Manager(TextInput1.Text).Mail).DisplayName

 

...and 2 levels up from my manager by way of just another wrapper of:

Office365Users.Manager(Office365Users.Manager(Office365Users.Manager(TextInput1.Text).Mail).Mail).DisplayName

 

...main question is now how do I do a loop and check each loop for the JobTitle to see if it starts with 'VP'?

If it doesn't exist, I need to keep going up and adding the Office365Users.Manager().

Only way to really do a loop is using timer control. You would have to basically say, restart timer when say condition doesn't contain VP or isblank (value) or manager = the CEO title. or something to prevent a infinite loop or to stop at top level. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-timer

So no way to use Office365Users.Manager() in Flow?

tdent
Frequent Visitor

I know this thread is a bit old, but I'm looking to do the same thing (except with an SVP). Did anyone here have any luck in figuring this out and if so, could you provide screenshots of the Flow? Thanks in advance!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,998)