Business Central select document approver 🔍👤✅

This post came about due to the below question on the Dynamics Community forum:

Here is how I would solve this one with Power Automate. Initially use one of the templates available on power automate for creating document approvals. This gives you the perfect head start. In BC itself you need to decide on using one of two standard fields. On sales and purchase documents you have either salesperson/purchaser code or assigned user ID. The latter is my favoured option. The list is maintained in a better way and you don’t have to worry about character limits. Is it a problem that a user could choose themselves? Read on to find out 😏

Both of the mentioned fields are already in the data available from Power Automate – not ruling out a custom field but not including it in my post.

Four things to do in Power Automate once you have the template pointing to the correct database and company etc.:

The assigned to property of the approvals action needs a valid email address for a user in the directory. Simple hard code your internal email domain after the user value. Purchaser/salesperson codes might not follow a username type logic forcing you down the assigned user ID route.
Three alterations remain from the template. I’ve moved the approval action into the “if yes” of condition 2. This is where you check a self approval isn’t being done. The approver email must not match the sender email. It makes sense to add a rejection action in the “if no” part of the condition. Repeat this for condition 3 of the template – difference being that is the main rejection step.

There is now a dependency on the assigned user ID field being populated. Arguably a new condition should be added so you can reject and email/team’s message the sender and have them populate the field. I’ve opted against that and adjusted the workflow record in BC instead. This will stop the approval request from triggering so well trained users will spot what is missing.

Go to the workflow record and access the “On condition” of the top row in the workflow steps.
I’ve added a filter for my chosen field of “assigned user ID”