How to Execute a Workflow via JavaScript CRM Dynamics 365

Executing a workflow in through JavaScript:

function SendtoInformationRecieved() {
    var CONST_senToInformationReceivedWorkflow = '0ABB15B2-3259-48A2-8DB8-0C6FD363D7C5'

    var parameters = {};
    parameters.EntityId = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");

    var req = new XMLHttpRequest();
    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/workflows(" + CONST_senToInformationReceivedWorkflow + ")/Microsoft.Dynamics.CRM.ExecuteWorkflow", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var results = JSON.parse(this.response);
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send(JSON.stringify(parameters));
    Xrm.Page.data.entity.save('saveandclose');

Keep Exploring
Getting Ripped off at the Dealership