SEND EMAIL through Web API request in MS CRM 2016

‘email‘ is a bound entity to use SendEmail Action.

‘IssueSend‘ is the Boolean parameter to be passed to the action.

If ‘IssueSend’ = true, then the email will mark the email to be sent.

Activity Status = Pending Send

If ‘IssueSend’ = false, then the email will be marked as sent.

Activity Status = Sent

var parameters =
   {
       "IssueSend": false
   };

var request = new XMLHttpRequest();
request.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/emails(5F3753B9-0856-E611-80EA-005056981E85)/Microsoft.Dynamics.CRM.SendEmail", true);
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=utf-8");
request.setRequestHeader("OData-MaxVersion", "4.0");
request.setRequestHeader("OData-Version", "4.0");
request.onreadystatechange = function () {
    if (this.readyState === 4) {
        request.onreadystatechange = null;
        if (this.status === 204) {
            // Success - returns sendemailresponse.
        }
    }
};
request.send(JSON.stringify(parameters));

Comments

Popular posts from this blog

Meta Data Using WebApiRequest

Sample CRUD Operations Using C# in MSCRM

Basic Plugin Code in D365 using C#