The two web resource (json2.js and sdk.rest.js) are located at: sdk\samplecode\js\restendpoint\javascriptrestdataoperations\javascriptrestdataoperations
Code: Select all
function updateIsPriceOverridden() { //update field of opportunity product-associated with opportunity entity
var id = Xrm.Page.data.entity.getId();
SDK.REST.retrieveRecord(id, "Opportunity", null, "product_opportunities", updateOpportunityProduct, errorHandler);
}
function updateOpportunityProduct(id_pass) {
var gridControl = document.getElementById('opportunityproductsGrid').control
var ids = gridControl.get_allRecordIds();
var changes = {};
changes.IsPriceOverridden = true;
for (i = 0; i < ids.length; i++) {
SDK.REST.updateRecord(id_pass.product_opportunities.results[i].OpportunityProductId, changes,
"OpportunityProduct", updateOpportunityProductCompleted, errorHandler);
}
}
function updateOpportunityProductCompleted() {
//do nothing
}
function errorHandler() {
//do nothing
}