cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ASLR
Level: Powered On

Approval for dynamic users

Hi Guys,

I’m a newbie to Microsoft Flow and been using it for a couple days so far and was wondering if there was any sort of documentation on the new actions such as Get Manager, Get Profile etc to fully understand it.

Also, I’m trying to create a functional workflow for a Leave Request App where there are two sets of Approvals. Manager and HR.

 

List Columns

Title: Single line of Text

Start Date: Date and Time

End Date: Date and Time

Comments: Single line of Text

Approved: Yes/No

Manager: Person or Group

Status: Single line of Text

 

During the request at this point in time, the requester has to type in the Manager’s Name in the Manager field therefore this field is dynamic as each user has a different manager. The AD isn’t set up to know who belongs to which department and the assigned manager therefore it will be selected by the user upon the request. Is there a way to send the request to the manager for approval only when the user types in the Manager’s name?

 

Another issue is the HR has a SharePoint Group where all emails/requests coming in has to go to selected users. How can I select a SharePoint Group to assign a task to?

 

Are we allowed to do calculations using these flows or should we still use SharePoint Designer to do so?

 

Thanks in advance,

Much appreciated.

ASLR

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Approval for dynamic users

Hi @ASLR,

 

A quick update on the PowerApps part. After doing some research, someone suggested a way to retrieve the current user's manager and automatically populate the corresponding manager field.

First, if you don't have a data connection to Office 365 Users, please set that up. Once you have this connection set up, these are the steps to follow:

  1. On the screen where your form is located, set the screen OnStart property to this:
    Collect(UserProfileCollection, Office365Users.MyProfile())
  2. On the same screen, set the OnVisible property to this:
    UpdateContext(
      {
        Manager: Office365Users.Manager(First(UserProfileCollection).Id)
      }
    )
  3. In the form, select the Person/Group DataCardValue and set its Default property to this:
    {
      '@odata.type':"Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
      Claims:Concatenate("i:0#.f|membership|",Manager.Mail),
      Department:Manager.Department,
      DisplayName:Manager.DisplayName,
      Email:Manager.Mail,
      JobTitle:Manager.JobTitle,Picture:""
    }

Here's the link to the post I used for reference since I asked the question in the forum 
The property expects Record values, but this rule produces incompatible Text values

 

I will continue working on the Flow as time permits and report back.

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

Super User
Super User

Re: Approval for dynamic users

Glad you found that workaround. I tried it as well, but doing it directly in Azure AD using PowerShell seems to work better for syncing. Let me know if there's anything else I can assist with.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

9 REPLIES 9
Super User
Super User

Re: Approval for dynamic users

Hello @ASLR,

 

The comments below are opinions and suggestions for what you are trying to achieve. First, it seems like Flow documentation is lacking in many of the actions, but one thing I would do, for testing of course, I would create a workflow to be triggered manually and then call the specific action, which in my case, I called the Get My Profile action. This action just returned everything available on my profile such as User id, Display name, Email, Job title, Business phone, and many more. I would start there just to have an idea what I will get.

 

Second, for the Leave Request App, I think what you are trying to do is pretty straight forward. The only thing I think you need to determine is how to route the email/request to the selected HR SharePoint group. If there are several SharePoing groups for HR, you will have to set up conditions in order for the emails/requests to be routed to the pertaining HR group.

 

Question on the app: are you using a custom list form or PowerApps?


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


ASLR12
Level: Powered On

Re: Approval for dynamic users

Thank you, Faustocapellanj for your response.

 

The workflow is pretty simple and straightforward and the conditions used work perfectly. It’s already built in SharePoint Designer and works so the intention was to build this same workflow using Microsoft Flow because of the enhanced features like Mobile Approval via the Flow App and Approvals straight from an Email.

 

At this stage, a PowerApp is being used to submit the Leave Request or someone can submit a request from the custom list in SharePoint but I will like to make it simple too for the Approvers to approved stuff instead of going into the SharePoint List to approve it. I’ve been testing Flow for some days now and its super quick in sending out alerts and the interface looks very professional and well put together.

 

However, in building the Flow so far I’m facing the difficulty in pulling the Manager’s email when the requester enters the Manager’s email/Name in the Request Form itself and selecting the HR group from the SharePoint Groups so to assign the approval to the Manager and HR Group. Currently, I’m using a temporary email to ensure the flow is executing properly and it works for the first stage but when it reaches the HR for approval, the email comes in and the Flow Alert comes in but when I choose to approve it, I’m getting an error stating something went wrong and disappears from the Approval Feeds.

 

There is something I’m getting wrong when it comes to placing the correct Actions for getting profiles, manager profile etc.

  1. How can this work if those relationships are not defined clearly anywhere else in AD or Azure?
  2. Do I need to use ‘Get Manager’, ‘Get Profile’ actions etc before I use the Approval Action each time?
Super User
Super User

Re: Approval for dynamic users

Hello @ASLR12,

 

Sorry for the late reply. Is there any chance you can post the SharePoint list structure, the PowerApps screen and the Flow steps so I can try to re-create it on my end and see if I can get it to work? Thanks


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


ASLR12
Level: Powered On

Re: Approval for dynamic users

The SharePoint List Structure:

Name of List: Vacation Test

 

Columns:

Title: Single line of Text

StartDate: Date and Time

EndDate: Date and Time

Comments: Single Line of Text

Manager: Person or Group

Status: Single line of Text

 

ManagerApproval: Choice (Yes/No)

HRApproval: Choice (Yes/No)

 

How can we customize the outcome fields as well to show up on the approval emails being sent to the emails and flow app?

 

Simple workflow process

 

Stage 1: Request for Vacation (Team Member)

Email goes to Manager

 

Stage 2: Manager Approval (Manager)

Approval Required

If yes go to Stage 3

If no go to end of workflow and email Team member

 

Stage3: HR Approval (HR Group)

Approval Required

If yes end workflow and email of approval goes to Team Member

 

When the Team Member submits a request to his manager, he should be able to select his manager on the Manager Field on the request form. (This is only temporary until we get to automatically populate the Manager of the Team Member from the Azure.) This is where I think I’m going wrong.

In Azure AD I selected a user profile of the manager and copied the Object ID to the Team Member profile as the Manager ID by a simple copy and paste. However, this isn’t creating the relationship because in Microsoft FLOW is stating

No manager found for the specified user. clientRequestId: c99a320e-e712-4ba2-8a62-a8311a1a53f8

 

Another issue is depending on the outcome of the conditions placed in the workflow how do I assigned the approvers for each stage If you cannot use the sharepoint groups. Also, In SharePoint Designer fields were created in individual content type with an outcome task but if we are using one list with the columns above how do we separate this in FLOW so that the requester would not see the ManagerApproval and HRApproval columns. Plus how would the approvers know which fields to look for when approving it since Flow only sends the emails with APPROVE AND REJECT AND THE FLOW APP to APPROVE OR REJECT.

 FLOW1.pngFLOW2.pngPOWERAPP1.JPG

 

Sorry about all the questions, just trying to understand how FLOW works better.

Thanks for all the help, really appreciate it.

Regards

Super User
Super User

Re: Approval for dynamic users

Thanks for providing all that info @ASLR12. I'm also in the process of learning more about Flow and user cases like yours help more in the learning. I will post back if I have any other questions or if I get to figure out your scenario.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


ASLR
Level: Powered On

Re: Approval for dynamic users

No problem, thanks for your information. 

I am leaning towards an issue in the Azure AD relationship between the Manager and team member because when a static email is used in the Approval action in the Assigned To feild, it works fine but for some reason it is not pulling the Manager when it is left blank.The relationship between the Manager and Team Member was also relink in AD and it still did not work. 

 

There should be a way though in FLOW as an option to allow users to be selected dynamically by the requester like it did in SP Designer. Although,I appreciate Microsoft wants to make it easier when excuting this function it's always a good idea to have an option in case one doesn't work properly. 

 

Regards, 

ASLR12

 

 

 

 

Super User
Super User

Re: Approval for dynamic users

Hi @ASLR,

 

A quick update on the PowerApps part. After doing some research, someone suggested a way to retrieve the current user's manager and automatically populate the corresponding manager field.

First, if you don't have a data connection to Office 365 Users, please set that up. Once you have this connection set up, these are the steps to follow:

  1. On the screen where your form is located, set the screen OnStart property to this:
    Collect(UserProfileCollection, Office365Users.MyProfile())
  2. On the same screen, set the OnVisible property to this:
    UpdateContext(
      {
        Manager: Office365Users.Manager(First(UserProfileCollection).Id)
      }
    )
  3. In the form, select the Person/Group DataCardValue and set its Default property to this:
    {
      '@odata.type':"Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
      Claims:Concatenate("i:0#.f|membership|",Manager.Mail),
      Department:Manager.Department,
      DisplayName:Manager.DisplayName,
      Email:Manager.Mail,
      JobTitle:Manager.JobTitle,Picture:""
    }

Here's the link to the post I used for reference since I asked the question in the forum 
The property expects Record values, but this rule produces incompatible Text values

 

I will continue working on the Flow as time permits and report back.

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

ASLR
Level: Powered On

Re: Approval for dynamic users

Great post, much appreciated. 

 

I found a workaround as well

 

SharePoint Admin Center - Manage User Profile - Enter Usee's Name - Edit My Profile - Manager -enter manager's name and save. 

 

This will be sync to Azure and O365 Admin.

 

Thanks a million. 

 

Regards, 

ASLR12

 

 

 

Super User
Super User

Re: Approval for dynamic users

Glad you found that workaround. I tried it as well, but doing it directly in Azure AD using PowerShell seems to work better for syncing. Let me know if there's anything else I can assist with.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,385)