Customize Main Form Button in Model-driven App Using Ribbon Workbench

 

Customize Main Form Button in Model-driven App Using Ribbon Workbench

Sample JavaScript Code:

function updateRecord(primaryControl) {
    var entityName = "kc_operationsreview";
    var recordId = primaryControl.data.entity.getId();
    var data = {
        kc_reviewstatus: 948040001
    };

    Xrm.WebApi.updateRecord(entityName, recordId, data).then(
        function success(result) {
            console.log("Record updated successfully");
           
            // Refresh the form
            primaryControl.ui.refresh();
        },
        function error(err) {
            console.error(err.message);
            // handle error conditions
        }
    );
}

No comments:

Post a Comment