Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Microsoft Dynamics 365 Extensions Cookbook

You're reading from  Microsoft Dynamics 365 Extensions Cookbook

Product type Book
Published in Jun 2017
Publisher Packt
ISBN-13 9781786464170
Pages 462 pages
Edition 1st Edition
Languages

Table of Contents (19) Chapters

Title Page
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. No Code Extensions 2. Client-Side Extensions 3. SDK Enterprise Capabilities 4. Server-Side Extensions 5. External Integration 6. Enhancing Your Code 7. Security 8. DevOps 9. Dynamics 365 Extensions 10. Architectural Views 11. Dynamics 365

Building a configurable e-mail notification workflow


Workflows are one of the most powerful no-code extensions you can configure in Dynamics 365; without any code, you can automate repetitive business processes.

Workflows are versatile and can fulfill a wide range of functionalities, ranging from creating entities and sending e-mails to calling actions. In this recipe, we will create a workflow that sends an e-mail to any new students after 24 hours of their record being created.

Getting ready

Similar to the previous recipe, a System Customizer or higher security role is required to perform the configuration as well as a solution to contain the changes.

How to do it

  1. Navigate to Settings | Solutions | Packt.
  2. Under Processes, click on New.
  3. Fill in the following details:
    • Process name: Send Student Welcome Email
    • Category: Workflow
    • Entity: Contact
    • Tick Run this workflow in the background
    • Type: New blank process
  4. In the Process editor tick Record is created and As an on-demand. Keep the rest as is with their default values.
  5. Click on Add Step | Wait Condition.
  6. Click on <condition> (click to configure) and select the following:
    • Process in the first column
    • Execution time in the second column
    • Equals in the third column
    • In the last column, use the form assistance on the right-hand side:
      1. Select 1 under Day
      2. Select After
      3. Look for Process
      4. Double click Execution Time in the last list

 

 

  1. Click on Save and Close.
  2. Back in your process, click on Select this row and click Add Step, then click on Add Step | Check condition.
  3. Click on <condition> (click to configure) and enter the following details:
  • Contact, Email, and Contains Data
  • Contact, Contact Type, Equals, and Student (created in the previous recipe)
  • Contact, Status, Equals, and Active
  • Click on Save and Close:
    1. Click on Select this row and click Add Step, followed by Add Step | Send Email.
    2. Select Create New Message from the drop-down and click on Set Properties.
    3. Enter the details of the e-mail as follows:
    • From: <your name>
    • To: using Form Assistance on the right, select Contact under Look for followed by Contact from the next dropdown, then click on the Add button followed by the OK button at the bottom:
        • Enter Welcome to Packt University in the Subject Line option
        • Enter Hi
        • Using the right Form Assistance, select Contact, Last Name, and click on Add, then OK
        • Follow the salutation with a carriage return (Enter) and Welcome to Packt University
      1. Save and Close the dialog.

       

       

      1. Click on Activate at the top of the workflow:

      How it works...

      In step 2 to step 4, we created a workflow that triggers on creation (when the contact record is first created, the workflow will start waiting). The workflow can also be called on demand in case we want to trigger it again. In this example, the contact might already be created but not as a Student. Once the contact is set as a Student, the workflow can be triggered manually to send the welcome e-mail.

      In step 5 and step 6, we set up the wait condition to wait for a day.

      In step 7 and step 8, we checked if the contact is an active student with an e-mail address.

      In step 9 to step 12, we created a personalized e-mail for the contact and welcomed them.

      In step 13, we activated the workflow.

      Note

      As a good practice, always add descriptions to your workflow, and to each step, to understand at a high level what the workflow is doing.

      When asynchronous workflows are triggered, they enter into a pool to be processed when the asynchronous service is free. Asynchronous workflows are typically executed within seconds or minutes. If the execution is taking hours, then you might want to raise a support ticket with Microsoft to investigate. Executing workflows asynchronously is a great way to lighten the load on your Dynamics instances.

      When workflows instances are waiting for a condition to be satisfied, they do not consume resources or affect your instance's performance. However, it is generally agreed by the community that it is a bad practice to have too many workflow instances in a waiting status.

      There's more

      In more recent releases, synchronous workflows that turn your workflow into a configurable plugin became available. Microsoft does not recommend synchronous workflows for long processes due to the load that is associated with them. Furthermore, online instances have a limit of 2 minutes per synchronous workflow or plugin. Nevertheless, synchronous workflows are there to be used. Use them wisely.

      See also

      • The Creating your first custom workflow activity recipe of Chapter 4, Server-Side Extensions
      You have been reading a chapter from
      Microsoft Dynamics 365 Extensions Cookbook
      Published in: Jun 2017 Publisher: Packt ISBN-13: 9781786464170
      Register for a free Packt account to unlock a world of extra content!
      A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
      Unlock this book and the full library FREE for 7 days
      Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
      Renews at $15.99/month. Cancel anytime}