Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Gallery / Passion Dynamics / Insert dynamic values from ...

Insert dynamic values from custom entities in an email template – Microsoft Dynamics CRM

Rawish Kumar Profile Picture Posted by Rawish Kumar 13,752

if you work with email templates; you might have to create a template which is to be sent from a custom entity & hence you will need field values from that entity.

Now out of the box – CRM doesn’t provide you an option to populate the field values from a custom entity, so lets dig in and understand ; how this can be done.

1.Go to Templates from CRM settings and click on email templates ; click on “new” & in the popup select template as “Global”:

1

now if you notice – CRM gives you templates for individual entities as well but since we need one for custom entity – we will have to select global.

2. In the Template form, fill subject & Title.

2

3.In this example – i have a custom entity Loan, i would like to send email from this entity using an email template with Loan amount and customer populated. Customer is a lookup so lets do it.

Standard format is : {!EntityLogicalName:FieldLogicalName;}

for lookup values ; you would want to retrieve the name so you have to do it like below :

3

4. Hit save and it will be resolved:

4.png

5. now lets retrieve the loan amount which is a currency field:

5

6. Hit save and see the how this resolves as well:

6

if you have noticed – i have also inserted the current user name from out of the box feature “insert/update” from top button.

Similarly, you can do this with other fields like below :

single line of text : {!EntityLogicalName: FieldLogicalName; Default Text}

Date :  {!new_loan:new_approvaldate/@date;}
Time : {!new_loan:new_approvaldate/@time;}

Lookup : as we did above

Optionset : {!new_loan:new_loantype/@name;}

7. Now lets see our template in action ; i will go the loan entity record and insert a template:

7

Yay! it worked like a charm.

so , that is how it is done. Let me know if you face any difficulties.

Cheers!!

Categories:

Comments

*This post is locked for comments

  • Nirav Shilu Profile Picture Nirav Shilu 20
    Posted at
    Hello, i wonder if you could help me, how do i change settings for these dynamics values in the template i have it has code something like below... i cannot get my head around that where '[TableOfApplicants] fetches the value from, i can see the table populating in the draft email but it populates incorrect time. i want to find where the settings or such function will be Dear {Full Name(Contact (primary) (Contact))} I am pleased to confirm the details of the interview session we have arranged for you for your recent apprenticeship vacancy. The names and details of the applicant(s) who have been invited to attend are as follows: [TableOfApplicants] Applicants have been asked to attend at this address: [EmployerAddress] and to ask for {Contact (primary)(Vacancy)} when they arrive.
  • MMK Profile Picture MMK 745
    Posted at
    Great work bro
  • DennisGroen Profile Picture DennisGroen 85
    Posted at

    Hi Rawish,

    First, thank you for this clear tutorial. It should help resolve the issue i'm working on.

    But, second, when I use the above mentioned steps and hit Save it doesn't Resolve. Is there a known issue and resolution for this problem?

    The lookup I use is: {!Aanvraag:Gemaakt Op/@date;}, in English {!Case:Created On/@date;}.

    Note: a standard lookup {!Contactpersoon:Voornaam;}, in English {!Contact:FirstName;} doesn't Resolve either when menually entered.

    I'm looking forward to your response.

    Kind regards.

    Dennis Groen

  • Lord_Vader89 Profile Picture Lord_Vader89 15
    Posted at

    Hey,

    i have a field with email addresses from my company's employees which need to send those emails I create as templates.

    My problem is, that when the template is executed the mailadress does not work as a link (with the value mailto: xy@company.com).

    Any suggestion how I can depose the link in the field, so that it is beeing pulled from the template?

    Marius

  • Shubh_K Profile Picture Shubh_K 80
    Posted at

    Heyi Rawish,

    Thanks for sharing, I have similar kind of requirement but for a Custom entity Poll, I need to set a SMS template which can have facility to show filed value like email template.

    Poll record will have  a member list, and SMS should be set for each member record.

    How can I achieve this please suggest ? Is it possible to implement ?

  • Iron Arm Profile Picture Iron Arm 125
    Posted at

    Disregard my last comment. I got it to work.

  • Iron Arm Profile Picture Iron Arm 125
    Posted at

    Rawish, what version of Dynamics 365 are you using?

    I've tried {!EntityLogicalName:FieldLogicalName/@name;} and it does not work.  

    I'm using Version 1710 (9.1.0.3223) online

    If I remove "/@name" and just enter {!EntityLogicalName:FieldLogicalName;} on a lookup, it resolves to yellow which is promising, but when using the template in an email it resolves to:

    {8A4D6D35-2EF7-E811-A980-000D3AF3D2AF}

    Which means it's partially working.  If I add "/@name" it does not resolve at all.

  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at

    Hello, I am trying to do something similar but a bit more intensive.  I want to insert dynamic values in an email template but I want it to fetch a contact information.  For instance say I am sending an email to a new lead, and I want to introduce him to a contact and provide that contact's information how can i do that using your logic

  • Pawar Pravin  Profile Picture Pawar Pravin 5,225
    Posted at

    Hi Rawish,

    Thanks for such useful information. Can you please suggest me on 'how I can use dynamic date and time in template as current date & time'. I need to send email using email template with the help of plugin.

    Thanks in advance.

  • Community Member Profile Picture Community Member Microsoft Employee
    Posted at

    Rawish - I am able to put the format into the email templates, save them (they turn yellow) but when I go in to compose an email, insert the template the dynamic values are not retrieving data. Those fields have data that should be populating. Help needed.