Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Execute the SendEmailFromTemplate web api action issue

(0) ShareShare
ReportReport
Posted on by 680

Hi,

We tried to execute the SendEmailFromTemplate web api action using javascript but we are getting below issue.Is anyone face such type issue have solution for it.

The property 'subject' does not exist on type 'Microsoft.Dynamics.CRM.crmbaseentity'

Thanks!

*This post is locked for comments

  • Balasaheb Profile Picture
    Balasaheb 680 on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Hi Andrew,

    Thanks it worked.

    Thanks

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Your code was missing only 1 line - I replaced

    var  emailAct = new Object();

    with

    var emailAct = {

       "@odata.type": "Microsoft.Dynamics.CRM.email"

    };

    I posted cleaned version of code here - http://butenko.pro/2018/03/02/how-to-use-sendemailfromtemplate-action-with-javascript-and-webapi/

  • Balasaheb Profile Picture
    Balasaheb 680 on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Hi Andrew,

    Here is code that we tried.

    Note: we used David yack webapi library.

           var templateId = "B6C38BB9-2423-471D-8B38-E3B99ED80E7A";

           //create email activity

         var  emailAct = new Object();

           //create activity party collection

           var parties = [];

           var Sender = {}; //From

           Sender["partyid_systemuser@odata.bind"] = "/systemusers(1F9A5711-9FBA-4074-9C3D-46A9AFFBBA14)";//from

           Sender["participationtypemask"] = 1

           var Receipent = {};//To

           Receipent["partyid_account@odata.bind"] = "/accounts(EC0318D6-000B-E811-8107-3863BB2EB058)";

           Receipent["participationtypemask"] = 2;

           //push to the collection

           parties.push(Sender);

           parties.push(Receipent);

           //pass parties[] to email_activity_parties

           emailAct["email_activity_parties"] = parties;

           emailAct.subject = "Email Test Activity";

           emailAct["regardingobjectid_account@odata.bind"] = "/accounts(EC0318D6-000B-E811-8107-3863BB2EB058)";

           emailAct.actualdurationminutes = 60;

           emailAct.description = "Email Activity for testing using web api ";

            var regarding = {

               "accountid": "EC0318D6-000B-E811-8107-3863BB2EB058",

               "@odata.type": "Microsoft.Dynamics.CRM.account"

           }

           var target = {

               "activityid": "252BB0DA-591D-E811-8103-3863BB2E6290",

               "@odata.type": "Microsoft.Dynamics.CRM.email"

           }

           var req = {

               "TemplateId": templateId,

               "Regarding": regarding,

               "Target": emailAct

           };

           crmAPI.ExecuteAction("SendEmailFromTemplate", req, null, null).then(

                                           function (result2) {

                                               Xrm.Utility.alertDialog(result2);

                                           },

                                   function (error) {

                                       Xrm.Utility.alertDialog(functionName + ": Error: " + (error.message || error.description));

                                   })

    Please check  and let me your findings.

    Waiting for your reply.

    Thanks

  • a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Hello,

    Can you please provide your code?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans