Workflow Elements

Current Version: 3.1.0, released August 29, 2019


There are two huge updates for Workflow Elements.

  1. Workflow Elements is now open source and is available from GitHub. You can access all the source code here: You can also download the solutions directly from the Release page
  2. You can now install Workflow Elements for CDS. There is one solution for CDS which has all the activities that don’t rely on the traditional CRM entities, and another for CE which has all of the activities.

These are the two biggest requests I’ve had over the past two years and I’m happy to finally announce it.


A few pretty cool things:

  1. If you were unable to use Workflow Elements because of security concerns, now you can inspect the code to verify what it does.

  2. If your organization is using the Common Data Service without Dynamics 365, you’re now able to use the vast majority of workflow activities.

  3. You can embed the code directly in your project, so you can augment your current solutions without having to make sure Workflow Elements is also installed.

All documentation can still be found on while I migrate everything to GitHub.

Workflow Elements is a free solution for Dynamics 365 that gives you the tools to build workflow in ways you never thought possible. You can query for records (even filtering it to related records), insert tables into emails and tasks, format dates any way you want and more, all with a clean, easy to use interface.

In less than 5 minutes you can write a workflow that sends a fully customized itemized receipt to a customer with all of their product information. Normally you’d have to find a developer to write custom code for you, but not anymore. You can download from the App Source, or for CRM 2015 and earlier check out the download page for older versions.installFromAppSourcebutton_download-for-dynamics365-or-crm

I’m always looking for new ways people are using Workflow Elements so leave a comment or hit me up on Twitter (@AidenKaskela). If you experience any issues, check out the Reported Issues page to let me know so I can get it fixed.

Licensing: The Workflow Elements managed solutions are licensed under the MIT license, but if you’re interested in licensing an unmanaged solution and the source code, please email me at

What are workflow activities?

A workflow is a set of instructions that you combine to give CRM functionality to suit your business needs (Trigger: When an invoice is paid; Check: If the customer is an individual; Action: send an email confirmation). A workflow activity is one of the instructions, like a tool in the toolbox. Microsoft provides a lot of tools to let you do basic actions, but we need so much more. Fortunately, they’ve provided a way to expand on that with custom workflow activities.

A custom workflow activity can have input parameters and output parameters that you can interact with in your workflow. Having these simple mechanics available lets you build limitless custom activities. Whether it’s as simple as a math problem (you need to take in a number and return the square) or a complex integration, custom activities open up a whole world of customizations for the CRM user or Admin.

How are people using Workflow Elements?

Generate a full invoice and email a bill

One client of mine deals with support cases, and when a case is resolved he generates an invoice, queries for the amount of billable time spent on the case, add a product to the invoice for the billable time, generates a bill for the invoice from a Word Template, renames the document to include the invoice number, attaches the newly renamed document to an email, and sends it to the customer on the invoice. He was able to build a fully automated billing system with a handful of activities and no custom code.

Email record details when somebody updates a record

I have a client who has a lot of events and all of the setup data is housed in Dynamics 365, and when some of the records change they want a manager emailed with the old and the new values. They set up workflows to run on change, and used an activity to get audit details for the record, then sent out an email with the details. This always ensures a second set of eyes on any changes to critical data (which can happen pretty easily with auto-save).

Send an email as an itemized receipt

I have a the step by step details for how you can do this for yourself. The organization has a workflow that runs when an invoice is paid. They have a query run to retrieve the invoice details for that invoice, then embed the table into an email. 5 minutes to set up and a clean, professional looking email.

Use custom date formats in an email

When you’re emailing somebody and want to include a date from Dynamics, you don’t have any flexibility about how it’s displayed. In some cases you might want the date to read “Tuesday, July 4, 2017”, or “7/4/2017 12:30 pm”,  and in others it could be “20170704 1230”. You can build up a custom date format and show a date time field however best fits your scenario.

And what are people saying?

We’ve just scratched the surface with this, but we’re already using it for weekly alerts to users for overdue follow-up, weekly activity emails to the sales managers, shipment notifications with line item detail from the invoices, sending quotes with the line item details to contacts and emails to our customers with all of the contacts in their organization so we make sure we keep the contact information clean and up-to-date.
– Joseph Markovich, Information Technology, Okaya Electric America

61 thoughts on “Workflow Elements

  1. Pingback: Microsoft Dynamics CRM | Field Service–Customer Reports - Microsoft Dynamics CRM Community

  2. It would be great to use the Query feature to prepare a list of people (through some complex parameters, fetchxml) and put that list as Recepients


  3. Related to the above, my biggest headache with workflows is when an entity has many related records e.g. A quote and quote products. You want to update a quote product while running a workflow from the quote and apply a change to a related quote product (or all related quote products) based upon a criteria. Ability to start a child workflow where the input parameter of the child workflow is the quote id where you are running the first workflow from would help. So in that way on child workflow first check criteria could be where parent quote I’d = quote id from parent workflow. This is pretty much impossible for me out of the box. Or did I miss something?


  4. Have a look at North52 formulas. I haven’t come across a problem that I haven’t been able to solve using it. At my current client we are using it to write some seriously complex business logic, including integration to SAP. the logic is written using an easy to understand language and has a ton of functions including fetchxml support


    • I’ve seen North52 before and it’s pretty impressive what they’ve built (and they charge accordingly). I’m not trying to build a workflow package to do everything for everyone; I want to build a simple solution to let the average non-technical user do some really cool things that should be available out of the box.


  5. I like this workflow solution as it gives you more control and it’s a simpler setup. With North52 solution what happens is that they add so many plugins and steps as part of scheduled formula that it affects overall system performance.

    Liked by 2 people

  6. Hi Aiden-

    This solution is absolutely amazing. Thank you for taking the time to write this AND take requests for additions! We’ve just scratched the surface with this, but we’re already using it for weekly alerts to users for overdue follow-up, weekly activity emails to the sales managers, shipment notifications with line item detail from the invoices, sending quotes with the line item details to contacts and emails to our customers with all of the contacts in their organization so we make sure we keep the contact information clean and up-to-date.


    Liked by 1 person

  7. Hi Aiden,

    I’ve attempted to use the “Get a Table (Default Styles)” to send an email with the invoice products related to a the parent Invoice but instead I get an email with all Invoice Products in my system. Would you happen to know where I might have went wrong in my setup?


  8. Hi Aiden,

    First of all I would like to thank you for creating this wonderful solution!! I tried using “Add product to Order” and product description is not available when using the “Write-in Product Name”. Is it possible to be added to the workflow?



  9. Hi Aiden,

    Question about “Run on Query Results”. Can this be used to run workflows on sibling records?

    For example, I have a membership record of a certain type and I want to know whether contact has another membership record of a specific type. If that record is found, run workflow on it, if it is not found then run a workflow to create it.

    Thanks again!


    • Hi Reggie,

      The view would be something like: “Membership (of Type other), with a Contact, with a Membership (of Type this one), where Membership of type this one contains data.” That should give you just the other memberships.
      Run the query to check the number of results. If there is one, call “Query – Run Workflow on Results” with the same view and the workflow. If there isn’t one, create the record.



  10. Hello Aiden, this sounds amazing. I will try this soon. One requirement that I have run into is to query for a single record based on certain filter criteria (say Name) from an entity that is not related to the record that triggered the workflow. For example, say, you have a Custom Settings entity where you store certain global parameters (say Approval Limit) and you want to query the record and use the result in the workflow. Is this possible to add? Thanks.


    • Hi. Thanks for the comment. You can do that now using the activity – just build your view the way you normally would in an advanced find and make sure the value you want is the first column in the results. You’ll be able to get the field value in one of the “Single Value” return results.


      • That’s great – thanks! Would it be possible to update this unrelated record within the workflow?


      • Hi. You sure can do it, in a round-about way. If your related record was “Custom Setting” and you want to set a field, you’d have to have a workflow on ‘Custom Setting’ that has the update logic, and mark it as a child workflow. In the main workflow, call the activity ‘Workflow – Run on Query Results’ with the query for the custom settings. You won’t be able to pass any values into the child workflow unfortunately, but you may be able to retrieve any values you need by writing a query on the child.


  11. Pingback: Workflow Elements - Marcello Tonarelli Blog - Dynamics CRM Users - DUG

  12. I’ve just downloaded this and its brilliant! I needed to add a Order Line to every Order and this has made it possible. Is there any plans to add the ability to add additional fields to the “Sales – Add line item” workflow? I have some custome fields that I’d like to be able to add this way.

    Liked by 1 person

    • Hi Gary,

      Thanks! I tried a few tricks to allow that but didn’t have any success – what I wanted to do was return the line item as an output parameter so you could set whatever fields you want. The code was valid, but the workflow itself would ignore the order detail as a return parameter.

      One hackey way to do it is to have a field on your sales order that mirrors the field you want to set on the order details, so you have order detail “Other Description” and on the order, “Detail’s Order Description”. In your workflow, set the order’s field and then create the order detail. You’d add a workflow on the order detail so on create of the detail, update the detail’s Other Description with the field from the Order. If you had multiple line items, you’d update the order field before you create each item. It’s definitely hackey but should do the job.

      Good Luck! Aiden


      • Hi Aiden

        Thanks for the quick response, i’ve been reading it over and over trying to get my head round how to make it work. I’m really not sure what you mean, probably the mix of not enough CRM skill and its been a long day.



      • Hi Gary,

        I didn’t write that very well, so I think I deserve most of the blame 🙂 The idea I was going for is that you can’t push a value from the Order to the Order Detail, but if you’re on the Order Detail then you can pull a value from the Order.

        Add a new field to the Order that the Order Detail will pull from. Then, set up a workflow that runs on the Order Detail when it’s created, which sets your field on the detail, setting it to the new field on the Order. In your main Order workflow, instead of trying to set a field on the detail you just need to set the field on the Order, and create the Order Detail (and that workflow will set the field to whatever you set on the order).

        Hope this helps clear things up. If not, I’ll shoot you an email and we can get into more detail.



    • Hi Ilnur,

      Thanks for the awesome feedback. I won’t be adding anything for autonumber because there are a few good(ish) solutions for autonumbering for 8.2 and back, but starting with v9.0 autonumber attributes are possible out of the box.



  13. I used the Query Get Results to find a record and I like that I can use Single Value in the workflow conditions, but if I want to use the results of the Query to populate a lookup field in a workflow Update Record step, there are no options in the form assistant, it seems I can only update text fields. Could you add a EntityReference as an option to the Query?


  14. Pingback: Creating Useful Goal Updates Via Email - Microsoft Dynamics CRM Community

  15. Thank you!! – workflows are great!! – on the products anyway the next version could have parameters for Font style and size? so I can match it the rest of the email.


  16. Pingback: Microsoft Dynamics 365 Workflows: Workflow Steps - Microsoft Dynamics CRM Community

  17. Hi I am trying to get data from a N:N relationship. Would this tool allow for that? More specifically, I have a contact entity and a qualification entity and they are linked by a N:N relationship. What I am trying to do is find all qualification names for a contact and concatenate them into one string field in the contact entity. Would this tool make this possible?


    • Hi,

      Yes, you can do that. Build a query for the qualifications and link to contacts as I describe in the How To ‘Limit query results to related record’. In the columns for the search, make the name of the qualification the first column in the search result. Your workflow will be based on the contact, so call the activity ‘Query – Get Results’ and pass in the query. That activity returns a parameter ‘List – Query Results as a List’, which will be a comma separated list of whatever the first column is in your view. If you want to use semicolons instead of commas, you can set that on the ‘List – Item separator’ property on the get results activity.

      Good luck,


  18. Hey Aiden, I am back. Is there any difference between installing your solution from AppSource versus just importing the zipped file?


  19. Is it possible to generate a quote and email it similar to the example you have listed showing the order and invoice? I attempted to do this for quotes following steps similar to those you have shown for the invoice example but I can’t get it to work. You have no idea how amazing it would be if I could get this to work. Any help is greatly appreciated.


  20. This has been the most useful Dynamics CRM plugin I’ve found!
    Quick question about the Query for Results method when inserting as an HTML table into an email. Is there a way to force a width on the HTML table, such as 100%? I’m inserting the table into a draft email so I can use the Query for Recipients method, and the table gets inserted fine but the width of each column doesn’t seem to match the px width set in the view. Just wondering if there was some control over those widths.
    Thanks a million for this plug-in! It’s been hugely helpful!


    • Hi Mike! Thanks for the very kind words. The workflow activities aren’t setting with width of the table or its columns. My intent was to leave it up to the viewing device so they would be rendered proportionately, but I should have made the table 100% width. That was an oversight on my part and I’ll get it in an update. Also – if you want to see what the HTML is that’s generated from the activity you can take that HTML result from the workflow and put it in a non HTML field like a Task description, then open the Task and you can see all the text of the markup.



  21. Pingback: Microsoft Dynamics 365 Workflows: Panel Discussion Series - Microsoft Dynamics CRM Community

  22. Pingback: Workflow Heroes - Dynamics 365 for Sales Community

  23. Pingback: Add Team Members to another Team - Microsoft Dynamics CRM Community

  24. Pingback: Populating The Appointment Location Automatically - Microsoft Dynamics CRM Community

  25. Hi Aiden, such a fantastic tool! I would like to use the solution for notification emails when specific fields within a Conctact entity are modified (showing old and new value). I’m working with Dynamics CRM 2016 on-premise. Can I use the solution with the on-premise CRM? Thank you! Ania


    • Hi Ania, thank you for the kind words! Yes, as of today you can install Workflow Elements on version 8.0 up through 9.x. For your specific requirement, you’ll enable auditing on that entity and field and set up the workflow to run on change of that field. To send the email, first call “Audit – Get Last Update” and it’ll pull in the audit summary with the old value and the new one, then you can put the HTML Result in your email body like any other content. Enjoy!


  26. Pingback: Scheduling Recurring Emails Using A Workflow - Microsoft Dynamics CRM Community

  27. Pingback: I love regex: Replace URL with Link in Html table output of workflow action - Microsoft Dynamics 365 Community

  28. Hi Aiden ,

    My requirement is whenever any user click on button then that moment automatically word template attach with that mail and send a mail.
    Any help would be greatly appreciated!


  29. Hi Aiden,

    I’m trying to use the count function to count the number of emails sent in a period. As this number exceeds 5,000 it is currently just returning 5,000. Is there any way to do a count using your workflow to count more than 5,000 records?


    • HI Simon,

      If you’re using a traditional query then it tops out at 5,000 records as governed by the platform. If you’re trying to get the total count of records you could use aggregation in your FetchXml query to get the number of records. This maxes out at 50,000 records so it may be able to get you there depending on your data set.



Leave a Reply to Abhijit Shende Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s