cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Set Approver from another list by matching department

I am relatively new to flow and I have been searching through to find an answer but have yet to come across anything that I can get to work. I have 2 lists that I am looking to conduct lookups in.

 

List 1 is a list of requests initiated by users. In List 1, each person must identify what department they are assigned to in order to complete the request. I want to fill in the "Manager (Approver)" field with the approving manager(s) from List 2.

List 1.JPG

List 2 is a list of departments with 1 - 3 assigned managers that I want to feed into List 1 as the approver(s).

List 2.JPG

 

This seems it should be extremely simple and have tried a number of different flow configurations to try to get it to feed, but have had no luck. Can I get some help on writing this flow from the beginning to end? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Set Approver from another list by matching department

Hi @chancyrust yes this can be done and I've prepared an example below:

We have 2 lists: the first one holds the list of approvers with the department in the Title column and the approver's email ,address in the Approver column.

 

Approver listApprover list

 

We then have our main list for the approval requests:

Main approvals request listMain approvals request list

 

The flow then looks like this:
1. The trigger is "When a new item is created" in the Approvals list. The first action is to get the approver for the department selected by the user. To do this we use a Get items action and add a Filter query. As the department was in the Title column of the approvers list the filter query will be Title eq '{Department value}'. You select department value from the dynamic content and make sure you enclose it in apostrophes.

2-Trigger.png

 

2. We then want to populate the DecisionBy column in the approvals list with the Approver. So add an Update item action which will wrap itself in an Apply to each control. The first box in the Apply to each needs to be value from the Get items and you select this from the dynamic content. In the Update item add the ID from the When an item is created and also select the Title from the When an item is created (unless it's not a required column). In the DecisionBy field I have selected Approver from the Get items from the approvers section of the dynamic content.

3-First-Update.png

 3.  Next we need to add a Start and wait for an approval action. It will again wrap itself in an Apply to each and the field in that is again the value from the Get items from the approvers list. We assign the approval to the approver from the Get items - approver list in dynamic content. We add in whatever you want in the approval email.

4-Start-Approval.png

 4.  The next action is to do a second update on the Approvals list with the outcome of the approval. Again we select the ID from the When an item is created trigger and select the title  again (because in my example it's a required column in SharePoint). We then use the Outcome from the Start and wait for an approval section of the dynamic content, the Completion date, the Responses Approver name  - and when you add that it will wrap the action in another Apply to each - and the Responses comments.

5. If you wish to you can then send an email to original creator of the request with the outcome of their request.

6-Email.png

 So you can see how that works in the form and the list I have added a request to the approvals form in SharePoint, selected IT and then clicked Save:

7-Form.png

 The flow is then triggered and after a few seconds the DecisionBy (i.e. Approver) email is automatically added to the item:

8-first-update.png

 

Meanwhile the email has been sent to the approver who has added their comments and submitted the outcome:

9-Approval-Card.png

 

The SharePoint Approvals list is then updated with the outcome:

10-second-update.png

 And finally the requestor receives an email with the outcome:

11-email.png

 

It's quite a straightforward flow and took far longer to write this out and do the screenshots than it did to prepare the flow itself 🙂 but do come back with any questions.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Set Approver from another list by matching department

Hi @chancyrust yes this can be done and I've prepared an example below:

We have 2 lists: the first one holds the list of approvers with the department in the Title column and the approver's email ,address in the Approver column.

 

Approver listApprover list

 

We then have our main list for the approval requests:

Main approvals request listMain approvals request list

 

The flow then looks like this:
1. The trigger is "When a new item is created" in the Approvals list. The first action is to get the approver for the department selected by the user. To do this we use a Get items action and add a Filter query. As the department was in the Title column of the approvers list the filter query will be Title eq '{Department value}'. You select department value from the dynamic content and make sure you enclose it in apostrophes.

2-Trigger.png

 

2. We then want to populate the DecisionBy column in the approvals list with the Approver. So add an Update item action which will wrap itself in an Apply to each control. The first box in the Apply to each needs to be value from the Get items and you select this from the dynamic content. In the Update item add the ID from the When an item is created and also select the Title from the When an item is created (unless it's not a required column). In the DecisionBy field I have selected Approver from the Get items from the approvers section of the dynamic content.

3-First-Update.png

 3.  Next we need to add a Start and wait for an approval action. It will again wrap itself in an Apply to each and the field in that is again the value from the Get items from the approvers list. We assign the approval to the approver from the Get items - approver list in dynamic content. We add in whatever you want in the approval email.

4-Start-Approval.png

 4.  The next action is to do a second update on the Approvals list with the outcome of the approval. Again we select the ID from the When an item is created trigger and select the title  again (because in my example it's a required column in SharePoint). We then use the Outcome from the Start and wait for an approval section of the dynamic content, the Completion date, the Responses Approver name  - and when you add that it will wrap the action in another Apply to each - and the Responses comments.

5. If you wish to you can then send an email to original creator of the request with the outcome of their request.

6-Email.png

 So you can see how that works in the form and the list I have added a request to the approvals form in SharePoint, selected IT and then clicked Save:

7-Form.png

 The flow is then triggered and after a few seconds the DecisionBy (i.e. Approver) email is automatically added to the item:

8-first-update.png

 

Meanwhile the email has been sent to the approver who has added their comments and submitted the outcome:

9-Approval-Card.png

 

The SharePoint Approvals list is then updated with the outcome:

10-second-update.png

 And finally the requestor receives an email with the outcome:

11-email.png

 

It's quite a straightforward flow and took far longer to write this out and do the screenshots than it did to prepare the flow itself 🙂 but do come back with any questions.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,258)