Unlock Pricing in Microsoft Dynamics CRM
Hi All. In CRM Online, we generally face the problem where the field "Pricing"("ispriceoverridden") becomes locked at Opportunity Product, Quote Product or Order Product. So, the user becomes unable to change this field.Here I am going to explain how to overcome this problem at Order Product level. You can follow the similar steps at Opportunity Product and Quote Product also.
Step 1: Create a javascript webresource "OrderProduct" with the below code:
function unlockPricing() {
Xrm.Page.ui.controls.get("ispriceoverridden").setDisabled(false);
}
function onLoad() {
setTimeout(unlockPricing, 3000);
}
Step 2: Add the webresource to the Order Product form:
Step 3: Add the onLoad() function to the OnLoad event of the form:
Step 4: Save, publish and refresh the Order Product record. Now you can see the field is unlock and editable.
The reason for using the function setTimeout() is that if we simply add the function to unlock the field, it doesnt work because after form load event, the internal CRM function is called and locks the field. So, by using the function setTimeout(), the system waits for 3,4 seconds and then unlocks the field. In this way, it works successfully.