State Status Code Update On ServiceActivity Entity
// JavaScript source code
//var Id = Xrm.Page.data.entity.getId().replace("{","").replace("}","");
function changeStatus() {
debugger;
//Set the stage to send enquiry letter
XrmSvcToolkit.setState({
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entityName: "serviceappointment",
stateCode: 0,
statusCode: 1, //New
async: false,
});
//Save and Reload form
updateService();
Xrm.Page.data.refresh(true);
}
function updateService() {
debugger;
XrmSvcToolkit.updateRecord({
entityName: "ServiceAppointment",
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entity: { Category: "A.Purushotham" },
successCallback: function (result) {
alert("success" + result);
debugger;
statusclose();
},
errorCallback: function (error) {
debugger;
alert(error.message);
}
});
}
function statusclose() {
XrmSvcToolkit.setState({
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entityName: "serviceappointment",
stateCode: 1,
statusCode: 8, //New
async: false,
});
}
//var Id = Xrm.Page.data.entity.getId().replace("{","").replace("}","");
function changeStatus() {
debugger;
//Set the stage to send enquiry letter
XrmSvcToolkit.setState({
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entityName: "serviceappointment",
stateCode: 0,
statusCode: 1, //New
async: false,
});
//Save and Reload form
updateService();
Xrm.Page.data.refresh(true);
}
function updateService() {
debugger;
XrmSvcToolkit.updateRecord({
entityName: "ServiceAppointment",
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entity: { Category: "A.Purushotham" },
successCallback: function (result) {
alert("success" + result);
debugger;
statusclose();
},
errorCallback: function (error) {
debugger;
alert(error.message);
}
});
}
function statusclose() {
XrmSvcToolkit.setState({
id: Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""),
entityName: "serviceappointment",
stateCode: 1,
statusCode: 8, //New
async: false,
});
}
Comments
Post a Comment