update the status of the record using XrmSvcToolkit request

function setState() {
    //Set the stage to send enquiry letter
    XrmSvcToolkit.setState({
        id: Xrm.Page.data.entity.getId(),
        entityName: "lead",
        stateCode: 0,
        statusCode: 1, //New
        async: false,
    });
    //Save and Reload form
    Xrm.Page.data.refresh(true).then(null, null);
}

Comments

Popular posts from this blog

Calling Action using javascript with web api request in mscrm

how to get the XRM/FromContext on html page in D365.

When to use a workflow instead of a plug-in