@gowrihalan04 yes i have alread one js on form onload event
belove is code on quoteine onload
function onLoadSetSpec(executionContext) {
debugger;
var formContext = executionContext.getFormContext();
var quoteLookup = formContext.getAttribute("quoteid").getValue();
var quoteDetailIDAX = formContext.getAttribute("sar_quotedetailidax").getValue();
if ((quoteLookup != null)) {
var quoteGUID = quoteLookup[0].id;
quoteGUID = quoteGUID.replace('{', '').replace('}', '');
Xrm.WebApi.online.retrieveRecord("quote", quoteGUID, "?$select=name,revisionnumber,sar_quoteidax,statecode").then(
function success(result) {
var name = result["name"];
var revisionnumber = result["revisionnumber"];
var revisionnumber_formatted = result["revisionnumber@OData.Community.Display.V1.FormattedValue"];
var quoteIDAX = result["sar_quoteidax"];
var statecode = result["statecode"];
var statecode_formatted = result["statecode@OData.Community.Display.V1.FormattedValue"];
var previousRevionNumber = revisionnumber - 1
Xrm.WebApi.online.retrieveMultipleRecords("quote", "?$filter=revisionnumber eq " + previousRevionNumber+ " and statecode eq 3 and sar_quoteidax eq '" + quoteIDAX + "'").then(
function success(results) {
for (var i = 0; i < results.entities.length; i++) {
var quoteid = results.entities[i]["quoteid"];
//alert("Last Close Quote : " + quoteid);
if (quoteid != null) {
Xrm.WebApi.online.retrieveMultipleRecords("quotedetail", "?$select=quotedetailid,quotedetailname,_quoteid_value,sar_specificationsenglish,sar_specificationsfrench,sar_specsreviewed&$filter=_quoteid_value eq '" + quoteid + "' and sar_quotedetailidax eq '" + quoteDetailIDAX + "'").then(
function success(results) {
for (var i = 0; i < results.entities.length; i++) {
var quotedetailid = results.entities[i]["quotedetailid"];
var quotedetailname = results.entities[i]["quotedetailname"];
var _quoteid_value = results.entities[i]["_quoteid_value"];
var _quoteid_value_formatted = results.entities[i]["_quoteid_value@OData.Community.Display.V1.FormattedValue"];
var _quoteid_value_lookuplogicalname = results.entities[i]["_quoteid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var sar_specificationsenglish = results.entities[i]["sar_specificationsenglish"];
var sar_specificationsfrench = results.entities[i]["sar_specificationsfrench"];
var sar_specsreviewed = results.entities[i]["sar_specsreviewed"];
var sar_specsreviewed_formatted = results.entities[i]["sar_specsreviewed@OData.Community.Display.V1.FormattedValue"];
formContext.getAttribute("sar_specificationsenglish").setValue(sar_specificationsenglish);
formContext.getAttribute("sar_specificationsfrench").setValue(sar_specificationsfrench);
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
}
I have 2 custom field in quoteline- sar_specificationsenglish and sar_specificationsfrench
if a update this 2 field on quoteline and save quote line and after revise a quote, then changes were gone.
so i write that code for revise quote.
Now the problem with draft quote.
my quote is on draft state, and i modified those two field on quoteline. and save that form.
after refresh this page, then changes are gone
so what to do for this issue