web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Execute the SendEmailFromTemplate web api action issue

(0) ShareShare
ReportReport
Posted on by 700

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

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Hello,

    Can you please provide your code?

  • Balasaheb Profile Picture
    700 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

  • Verified answer
    a33ik Profile Picture
    84,331 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
    700 on at
    RE: Execute the SendEmailFromTemplate web api action issue

    Hi Andrew,

    Thanks it worked.

    Thanks

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans