cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheSlawekG
Helper I
Helper I

Looking for best solution for Approval depends on department

Hi,

 

I need to create a Flow but the first approver depends on the department selected in Forms. Then, the next 3 approvers are always the same so:

 

Department 1Department 2Department 3
Person 2Person 2Person 2
Person 3Person 3Person 3
Person 4Person 4Person 4

 

Is it possible to do like branches with conditions and send 1st approval depends on the department and then go back to one branch and continue the Flow to Person 2, 3, 4 doesn't matter what department was selected previously.

 

I don't want to duplicate the Flow under each IF statement as it will be the same for all routes.

 

Thank you for any suggestions.

 

Slawek

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

I would do this by creating a variable to hold the email address for the department approval.  Then use a switch statement to set that value.  After you exit the switch you can use the variable to complete the approval.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

9 REPLIES 9
Pstork1
Dual Super User III
Dual Super User III

I would do this by creating a variable to hold the email address for the department approval.  Then use a switch statement to set that value.  After you exit the switch you can use the variable to complete the approval.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

v-alzhan-msft
Community Support
Community Support

Hi @TheSlawekG ,

 

You could refer to screenshot below to create the flow:

1.png2.png

 

 

Best Regards,

Alice

 

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


@Pstork1 wrote:

I would do this by creating a variable to hold the email address for the department approval.  Then use a switch statement to set that value.  After you exit the switch you can use the variable to complete the approval.


 

This would be the best solution 

 

Then you just need to have 4 approvals loop after each other (and condition to go from one level to the other would be "if outcome is equal to approve")

 

If you're organisation is set up in O365, you could also use the Office Block with the action "get manager" from the one who triggered the flow

Thank you @Pstork1 

I like the solution, never been used Switch before but together with a variable it's excellent!

 

Thanks.

 

Slawek

Pstork1
Dual Super User III
Dual Super User III

Switch() is just like an IF() in many ways, but allows for more choices than two.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

My Flow starts when a new response is submitted and a document can be uploaded with the Form.

I parse the JSON of the field with upload and store the name of the file attached and its URL.

 

However, when there is no file uploaded the Parse JSON block fails.

parsejson_fail.PNG

The error is:

Unable to process template language expressions in action 'Parse_JSON' inputs at line '1' and column '63206': 'Required property 'content' expects a value but got null. Path ''.'.

 

I set something like this below to check if a file was uploaded:

compose.PNG

 

 But now I don't want to repeat the same flow (4 approvals) for YES and NO.

 

The ideal would be to use Switch but I tried with variables and it doesn't work.

 

Any ideas?

 

Thanks

 

Slawek

what is inside your Parse JSON block ? 

 

 

your blocks should look like : 

Parse JSON (from Form's file)

use this template :

 

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "link": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "type": {},
            "size": {
                "type": "integer"
            },
            "referenceId": {
                "type": "string"
            },
            "driveId": {
                "type": "string"
            },
            "status": {
                "type": "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}

 

Then

 

For Each

Get File (One Drive Block)

Add file to an element (Sharepoint block)

Capture.PNG

 

 

Details in last blocks : 

Capture.PNG

Hi @BenjaminJarry 

 

Did you try to run your Flow without uploading/attaching a file to the Form?

 

I just tried to implement your approach into my Flow and I get the same error.

Send the Form without File.

 

Thank you for your effort and suggestion.

 

Slawek

You need an IF condition before the PARSE JSON steps

you should have "get form answers details"

 

from this, you have to use length( the question where you store file) and check if it's > 0 

 

Capture.PNG

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (28,466)