Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to pass value from Plugin to CRM Email Template Body

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

I have one custom entity with password field, this field contains the password encryption value.I need to send the password decryption value using dynamics crm email template.I need to know how to pass value from plugin to Email Template body.

Regards,
Dinesh

*This post is locked for comments

  • DineshRaja Profile Picture
    on at
    RE: How to pass value from Plugin to CRM Email Template Body

    Thank You it is working..

  • Verified answer
    Kokulan Profile Picture
    18,054 on at
    RE: How to pass value from Plugin to CRM Email Template Body

    You could try the following

    email["description"] = email["description"].Replace("[!decrypt]", "YOUR VALUE");

  • DineshRaja Profile Picture
    on at
    RE: How to pass value from Plugin to CRM Email Template Body

    my placeholder name is [!decrypt]

  • DineshRaja Profile Picture
    on at
    RE: How to pass value from Plugin to CRM Email Template Body

    ok i take the response of the email and how can i change the placeholder of my email template

  • Verified answer
    Kokulan Profile Picture
    18,054 on at
    RE: How to pass value from Plugin to CRM Email Template Body

    In your code you could instantiate the template and get the email generated using InstantiateTemplateRequest

    InstantiateTemplateRequest instantiateTemplateRequest = new InstantiateTemplateRequest()

               {

                   ObjectId = userId

                     ,

                   ObjectType = "systemuser"

                     ,

                   TemplateId = template.Id

               };

               InstantiateTemplateResponse instantiateTemplateResponse = this.OrganizationService.Execute(instantiateTemplateRequest) as InstantiateTemplateResponse;

               Entity email = instantiateTemplateResponse.EntityCollection.Entities[0];

    the email generated here is not yet saved to the system, so you can get the email body and find and replace your unique place holder with the decryption value.

    Please follow the link below to see how you could work with generated email body.

    github.com/.../CreateCustomEmail.cs

  • DineshRaja Profile Picture
    on at
    RE: How to pass value from Plugin to CRM Email Template Body

    how to replace emailtemplate placeholder in plugin.

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at
    RE: How to pass value from Plugin to CRM Email Template Body

    Hi Dinesh

    There are few ways to get the email generated from a template to have the decryption value populated.

    01. You could add a field to the entity that the email template is based on and set the value to the decryption field (better not to enable auditing on this field) in the plugin just before you generate the email from the template. Once you created the email from the template, clear the decryption field value from the record.

    02. You could have your own unique place holder in the template, instantiate the template in the plugin, find and replace your unique placeholder with the decryption value

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans