In this blog we show how to quickly debug X++ code using the debugging feature in Microsoft Visual Studio for Dynamics 365 Finance & Operations.
Within your organization, it’s likely that scenarios exist in which a certain action requires someone's approval. By definition, we tend to lean towards yes/no or approve/reject type of answers when we think of approvals. But it’s not always so simple. Sometimes we need more information before we can approve, or we may need to provide tailored responses as a way to approve a request and also get it done. Consider these questions:
Many of these questions can be answered with a yes or no, but those same questions may also require a "need more info" response before providing a final yes or no. And obviously, the last two questions cannot be answered with a yes or no – they require detailed responses. So, how do we tackle such questions in our approval process for our organization? Let’s find out…
Microsoft Flow makes it a lot easier to automate such processes. Consider this example:
In our organization, if we have opportunities where the estimated revenue is greater than a certain value (e.g., $300,000) and the prospect is ready to buy immediately, our process calls for sending one of our best salespersons to close the deal. Depending on the type of prospect and their needs, we may want to send someone different each time. So, when there is a need for choosing who should be assigned to an opportunity, we can use "custom responses" within the Flow approval mechanism to automate this process.
In our Flow, we first set a couple of conditions that need to be checked each time an opportunity is updated: is the opportunity's estimated revenue greater than $300,000 and is the purchase timeframe "Immediate"?
If the answer to both is yes, we need to initiate the approval process. We will choose the Start and wait for an approval (v2) step and choose Custom Responses – Wait for one response (Premium) option. This gives us the ability to add our own responses to our approval email instead of just approve/reject. In our case, it's the approver, one of the salespeople, or all three who can go to close a deal, depending on the type of deal involved. To add custom responses, we just click Add new item and add the required number of responses.
The person in the Assigned to field gets the email from the approver. In the body of the email above, you may notice that some of the words have special characters around them Those are called markdowns, and they are used to format the text in an approval email in a certain manner. For example, ** is used for bold text, ## is for H2, etc. To see a complete list of markdowns, see this article.
Now, whenever an opportunity is updated, if the conditions set in this Flow are met, an email goes out to the approver that looks like this.
Notice the nicely formatted text within the email: Header 2 for opportunity topic ("Fungus Farm Northern Iowa") and the other bolded labels.
So, who should close this deal? The options are listed in the form of buttons. The approver will simply click the desired button and click Submit. If needed, they can add additional comments to the response, too – as shown in the attached file:
Based on the outcome of the approval email, we can make our Flow perform next steps, too. In our example, we want an email to go out to Justin notifying him that he will be working on this deal. In that email, we also want to add the comment that his approver added in the approval email from the prior step. For that to happen, we will add a Switch case in our Flow so that depending on who is chosen in the approver email, the next notification email goes to the correct person. This is what our Flow will look like:
The email looks like this:
So, there you have it! A simple Approval Flow with custom responses that can not only automate your approval process but also make it more meaningful to the type request that's being addressed. Try it out and tell us how you are using it in your organization! Don't forget to subscribe to our blog!
Happy Dynamics 365’ing!