CRM Software Logo

Microsoft Dynamics 365 & Dynamics CRM experts provide reviews and opinions to aid professionals with the Dynamics 365 selection process.

 
 

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

  1. Tal says:

    Hi,
    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:

          Jeff,
          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;}
            Thanks

  2. Michael says:

    Hi,
    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:

    Vitor,
    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,
      {!account:name;}
      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:

    Hi,

    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,
      Thanks!
      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,

      http://192.168.1.1/main.aspx?id={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.
        or
        How you resolved it.

        Thanks
        venkatesh

  7. Daniel says:

    Hi Mike, Hi Venkatesh,

    sorry for replying so late…
    Well I did find a solution but I was using a different workaround.
    The dataset is created via workflow. I just added another step to the workflow which updates the data with the URL. Therefore I added a field on the custom entity which then contains the URL of the Dataset.

    In the e-mail template I therefore can relate to the field with the URL. In combination with the href you can have a nice link to the dataset which shows the name but if you click on you get forwareded to the dataset.

    If you got further questions feel free to ask. I’ll try to check this website from time to time again.

  8. Pavan says:

    Hi Mike,

    I have a requirement to incremented value every time a new mail was sent out with that particular template for a case.

    Can this be done ? Let me know if you found out a way.

    Thanks for all the information 🙂

    • Mike says:

      Hi Pavan,
      Thanks for reading!
      Can’t think of a super clean way to do this…
      We’d need to persist that incremented value somewhere.
      I’m not sure where though…perhaps we could add a field on the case? though the incremented number wouldn’t be persistently consistent through all cases…
      Mike

  9. Pooj says:

    Hi Mike,

    Thank you for all the information, are really helpful. I have a question of how to format the date from MM/dd/yyyy to dd/MM/yyyy in an workflow email body.
    Value I get currently:
    Workflow body
    Date & time received: {Created On(Case)}
    Output Email body
    Date & time received: 2/9/2017 9:43 AM (this is 9th Feb 2017)

    This happens while the server as well as client date format already have formatted to be Australian Date Format which is dd/MM/yyyy h:mm tt.

    Thank you in advance,
    Pooj

  10. Mike says:

    Hey Pooj,
    Sorry for the really slow response. I was trying to think of a work around but nothing comes to mind. Displaying dates has always been a sore spot for me with CRM. I do mention how to display just the date, but I believe it does it based on the Organization’s base date format. Wish I had a better thought or idea for you. I’d love to hear if you thought of a work around for this.

    Thanks for reading,
    Mike

Ask This Expert a Question / Leave a Comment

 

 
 
Show Buttons
Hide Buttons