CRM Software Logo

A panel of Microsoft Dynamics CRM/Dynamics 365 experts provide reviews and opinions to aid professionals with the CRM selection process.


19 Responses to “Dynamic Values for Custom Entities in Email Templates”

  1. Tal says:

    This works with template type: Global?

    • Mike Watt says:

      Hi Tal,
      This will technically work for a template of any type, but in order to create an email template that references custom entities it has to be of Template Type: Global.

      • Jeff says:

        Is this possible to do? I’m using CRM 2016 and it doesn’t seem to work at all.

        • Mike says:

          I tried it with CRM 2016 and it worked fine. The field references are case sensitive so make sure that is correct. For example if I wanted to show the Account name it would be {!account:name;No name found}

          • Vitor Amaral says:

            Hey Mike,

            Account is a supported entity for using email template on. I can do it as well, but for other entities such as Campaign, even following the structure that shows above, i am not able to get a yellow dynamic tag upon saving the record.

            Can you check and see if you can do it for Campaign?

          • Mike says:

            Hey Vitor,
            Thanks for reading, I was able to get it to become yellow, make sure you have the casing right, here are two examples I did that worked for me,
            The Campaign’s Code {!campaign:codename;}
            The Campgin’s Name {!campaign:name;}

  2. Michael says:

    Thanks for the tip. It works fine but has issue with regarding: Creating Entity with an invalid parent. Entity: Email, ReferencingAttribute:regardingobjectid
    I’m wondering why crm sdk doesn’t have this syntax. Do you know if we could find it documented some where?

    • Mike says:

      Hi Michael,
      I’ve looked far and wide for any sort of documentation on this and have found nothing from Microsoft.
      As far as your question, I’m not sure I’m answering it, but I believe the issue might be that when setting the dynamic values it’s trying to insert the values based on the regarding object. Meaning it’s trying to find the ‘Regarding Object’ from the entity it’s regarding, which unless it’s an email it probably won’t have.
      Hopefully that makes sense, let me know if there are any other questions.

      • MIchael says:

        Hi Mike,
        The issue was in the setting. Emails are not allowed for the custom entity. The workaround is to create a child workflow (Custom action) and send a proper entity there as a parameter and then query the related entities.
        Yeh, it’s so pity about lack documentation from MS. Is there any other source?

  3. Mike says:

    I tried it with the Campaign entity and it worked. The string I used was {!campaign:name;No Name Found}

  4. Hamid says:

    Can you imbed dynamic fields straight into HTML Code then paste it in the email body. If so, what is the code that needs to be entered into the HTML code

    • Mike says:

      Hey Hamid,
      I believe what you’re asking is if you can combine html with the dynamic values? I was able to, here’s a simple hyperlink anchor tag that grabs the website url from the account and uses the account name as the text,
      Let me know if that answers your question

      • Mike says:

        well apparently you can embed hyperlinks into the comments
        so I tried to show, within an anchor tag, I set the href=”{!account:websiteurl;}” and then in between the start of the anchor I added {!account:name;}
        This sets the link to the accounts url and the text as the account name

  5. Stina says:


    Did you find a way to retrieve data from related entities?

  6. Daniel says:

    Thanks for this great blog entry!

    While i was experimenting with above knowlege two questions came up to my mind.

    1. How can I retrieve the URL of the record? I want to include the URL in my E-Mail.
    2.In reference to Hamid’s comment above: Could someone provide me the html5 code you’re using to embed hyperlinks with comments? (I have very little knowlege of html5 but the idea you’re describing sounds great)

    Any help is appreciated 🙂

    • Mike says:

      Hey Daniel,
      So, unlike with dialogs and workflows, where you can select Record URL (Dynamic) from the side menu, there’s nothing really similar to that from here. However I did find a bit of a work around. all you really need to open a new record is the server name (just your crm url), entity name and entity id.
      So within an anchor tag, for the href you could do something like this.

      {Server Name}/main.aspx?id={Entity Id}&newWindow=true&etn={Entity Name}&pagetype=entityrecord

      So for the entity id, we can use a dynamic value, and since by default the lookup dynamic values populate with the id or GUID, we can use that.
      For Entity name we can just hard code that with the entity’s logical name.
      So for example if we wanted the url to the contact record, the url would look similar to,{contact:contactid;}&newWindow=true&etn=contact&pagetype=entityrecord

      and as usual, when you save the template, the contact area should turn yellow if you did it correctly.
      Let me know if you have an further questions!

      • venkatesh says:

        Hi Daniel ,

        I have this requirement to show the record link in my email content.
        could you please let me know if Mike’s solution worked for you.
        How you resolved it.


Ask This Expert a Question / Leave a Comment


Show Buttons
Hide Buttons