How to insert dynamic values from custom entities in an email template – Microsoft Dynamics CRM

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

 

 

 

 

21 thoughts on “How to insert dynamic values from custom entities in an email template – Microsoft Dynamics CRM

  1. Hi Rawish!
    This is awesome and it works fine for me… except when the email is automatically sent via a workflow… in that case the dynamic values are just blank. Any ideas on this? It would be really helpful!

    Liked by 1 person

  2. Pingback: Email Template Demystified – Passion Dynamics

  3. Pingback: Email Template Demystified - Microsoft Dynamics CRM Community

  4. is there a way to fetch other fields from the lookup entity
    Something like this: (because when I tried this the CRM is only able to pick data for name and not any other fields for lookups)
    Optionset : {!new_loan:new_loantype/@tenure;}
    Optionset : {!new_loan:new_loantype/@interestrate;}

    Like

  5. Hey the above example is perfect.
    I had a concern of loading other values from lookup entity
    Something like
    Optionset : {!new_loan:new_loantype/@name;} //works
    Optionset : {!new_loan:new_loantype/@tenure;} //does not work
    Optionset : {!new_loan:new_loantype/@interestrate;} //does not work

    Can you help me with this

    Like

  6. Pingback: Creating Tables In A Custom Entity Global Email Template Made Easy! • HSD

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.