Tuesday 16 August 2016

Unlock Pricing in Microsoft Dynamics CRM i.e. at Opportunity Product, Quote Product or Order Product

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.

7 comments:

  1. After applying your fix in CRM 2016 this it the error i get. Even after deleting the script from the form and solution itself.
    ---------------------------------------
    One of the scripts for this record has caused an error. For more details, download the log file.
    TypeError: Cannot use 'in' operator to search for '18b26f7a-6c0f-e611-80ce-080027b84f2b' in null at addRecord (http://v-machine:5555/OBSDev/_common/JsProvider.ashx?bundle=FormControlBundle&ids=1223231347-405283869:13591:22)
    --------------------------------------
    Regards
    KK

    ReplyDelete
    Replies
    1. Hi KK,

      The error which you mentioned above is not because of my script. These error are generated because of some parsing issues. I think in some other script you are using some variable as string,int instead of using as an object...

      Delete
  2. Wow, Absolutely brilliant information Regarding Microsoft Dynamics CRM. I'm in love with this blog. You always provide such a great information.

    ReplyDelete