Workflows with Email Configuration | Microsoft Dynamics 365

Workflows with Email Configuration | Microsoft Dynamics 365

The article sections include step-by-step instructions on how to set up a simple (but dynamic) e-mail template or message, which automatically gets its information from a message configured within a workflow. A basic function that clients often are interested in when making use of the Dynamics workflow functionality, is being able to send and receive an e-mail when a workflow action occurs. Unfortunately, it is also one of those areas of the system where the configuration easily can get a bit tricky, given the number of required steps and lack of detailed Microsoft documentation.

Companies normally implement workflows due to following reasons:

  • Streamline Business Operations
  • Transparency & Accountability
  • Improve Internal Communication

Let's move on to the configurations in Microsoft Dynamics 365.

Step 1: Setup Email Template

Note: Some workflows require setting up email templates organization-wide which can be done through System Administration > Setup > Email > Email Messages. The setup is the same as mentioned in the below steps. In the steps mentioned below, I have set it up through the Organization Administration module. Read the Microsoft article mentioned below to learn more about workflow types.

Workflow types | Microsoft Docs

No alt text provided for this image

Navigation: Organization Administration > Setup > Organization Email Templates

Steps:

  1. Type Email ID as "Alert".
  2. Email Description as "Email Template".
  3. The sender name will appear on the email so type "Administrator".
  4. Provide the sender email which will be the email we will set up in the parameters later.
  5. Select the relevant language from the drop-down menu.
  6. Select "Normal" priority.
  7. Provide the batch group and make sure the batch servers are connected.
  8. Select the language.
  9. Type "%subject%" in the subject tab. This will auto-pick the subject defined in the workflow tool.
  10. The email message is the trickiest part. This is where a little HTML code gets involved. If you are a newbie like me you can use the following code.

HTML Template

  1. The image code must be used from an open-source URL.
  2. The %message% code will fetch the message defined in the workflow tool.

Now save the HTML code in txt. file and upload by clicking on the "Email message" button.

No alt text provided for this image

  1. Click on the "Email Message" button.
  2. Browse and upload the txt. file.
  3. The logo and the %message% code (which picks up the message defined in the workflow tool) will appear in the box.

Step 2: Setup Email Parameters

Setting up email parameters seems to be a tough part of configuration but in reality, it's easy. Better reach out to the IT department to configure it or read the Microsoft doc to get more clarity on it.

Configure and send email - Finance & Operations | Dynamics 365 | Microsoft Docs

Navigation: System Administration > Email > Email Parameters

No alt text provided for this image

Steps:

  1. Batch email provider specifies which email provider will be used to send emails that are sent by processes in a batch or non-interactive manner. The Exchange provider will use the account associated with the batch process. Select the relevant batch email provider SMTP/Exchange.
  2. Enable the relevant email provider from the available list.

No alt text provided for this image

Steps:

  1. Mention the outgoing mail server and SMTP port number.
  2. Enable the checkmarks as above.
  3. Provide the username and the password of the Admin email server of the company. Once it's authenticated you can send a test email.

No alt text provided for this image

Steps:

  1. Provide the email provider and mention the email address on which you would like to receive a test email.
  2. Click on the "Send test email" button.

If the test email is successful a message will pop up.

Step 3: Design the Email Message in the Workflow tool

In the example. I've created a simple basic Purchase Order workflow in the Procurement and Sourcing module.

No alt text provided for this image

Steps:

  1. Click on "Workflow".
  2. Click on Basic Settings.
  3. Select the Email Template for workflow notification as designed in the first step (I.e. Alert).
  4. Type the submission instruction according to the business needs. The submission instruction message will be visible to the submitter/user at the time of submitting on the front end. This will have no impact on the email.
  5. Now click on the "Approval Step" to design the email message which will be sent to the approver.

No alt text provided for this image

  1. Click on step 1.
  2. Click on Basic Settings.
  3. Workitem subject is the subject of the email. You can design messages according to business needs and use different placeholders. In the example, I've used the Purchase order number placeholder.

Request to Approve Purchase Order (%Purchase orders.PurchId%)

  1. Workitem instruction is the body of the email.

A purchase order has just been submitted for your approval, kindly review it.

Company Name: Test

Purchase Order: %Purchase orders.PurchId%

Vendor Name: %Purchase orders.PurchName%

Amount: %Purchase orders.Invoice amount% Rs

Procurement Category: %Purchase orders.Purchase order lines.ProcurementCategory%

Kindly click on the %Workflow.Link to web% to view it.

No alt text provided for this image

You can also design an email message for different events and assign a user.

Once done, make sure to save and activate the workflows. If you would like to learn more about the placeholders, search for the Microsoft Doc.

Step 4: Enable Workflow notifications from User Settings

Navigation: System Administration > Users > Users

No alt text provided for this image

  1. Select users assigned in the workflow and click on "User Options".

No alt text provided for this image

The above sender email tab is a great feature for testing purposes. It basically overrides the user email address and sends emails to the address defined in that tab. Make sure to select the email provider ID.

No alt text provided for this image

Checkmark "Send notification in email" so that the user starts receiving workflow emails. This should be enabled for all users in the workflow.

Step 5: Activate Workflow and Email distributor Batch Jobs

Workflow Batch Job

Navigation: System administration > Workflow > Workflow infrastructure configuration

No alt text provided for this image

Email Distributor Batch

Navigation: System administration > Periodic Tasks > Email Processing > Email Distributor Batch

No alt text provided for this image

  1. Make sure to checkmark "Batch Processing".
  2. Select Batch Group.
  3. Set up a recurrence. Make sure the recurrence of the email distributor job is after the workflow batch.

Outcome

The outcome of the configuration above can be seen from the screenshot below, which contains an example of the e-mail that is received by an approver, once a user has submitted the work item.

No alt text provided for this image

Hope you learned from this article. Keep learning and sharing.

Feel free to contact me in case of any queries.

Muhammad Ahmad Khan

[email protected]

CA Yash Dhamecha

D365-Finance & Operations|Business Analyst| ERP Implementation

9 个月

Hi Muhammad, Thanks for this detailed article and making the tricky workflow email configuration more logical. However, while following your steps and adding "ChangeRequest" as an additional activity to get the notification, I faced an issue of receiving a couple of emails for a Change request to the originator of the workflow. Out of those couple of emails, the first email was as intended based on the tool template + workflow tool configuration. However, the second email has not been configured anywhere in the system. Let me know if you know the RC for this and if you have any resolution about the mentioned issue.

回复
Ahmad Hassan ?

Microsoft Certified D365 & AX2012 F&O Developer | Commerce | Technical Consultant Specializing in #D365, #AX2012, #Commerce, and #ERP solutions, I bring expertise in #SQL, #PowerBI, and #AzureDevOps.

1 年

Muhammad Ahmad Khan very Helpful Thanks!

Khawaja Muhammad Bilal Kashmiri

A.F. Solution Architect》MCP 》MS Dynamics AX & D365 F&O 》Supply Chain Professional》Gold Medalist 》Hospital & Lab MIS 》Retail Applications 》Integrations 》Customized ERP 》Power Automates

1 年

Buddy thanks for this article. Keep posting and helping!

Syed Mujahid Abbas Bukhari

Digitalization Expert | Solution Architect | Business Analyst | Functional Consultant - Microsoft Dynamics 365 Finance & Operations | Business Central | Business Applications at Techvista Qatar

1 年

Perfectly sequenced and stepped ! Best Wishes.

Thanks for posting Muhammad Ahmad Khan very useful content. Keeping posting

要查看或添加评论,请登录

社区洞察

其他会员也浏览了