Default Price List on an Entity

by BenVollmer

I had a client that didn’t like to enter the Price List on their opportunity every time because they only had one price list.  So here is a little piece of code to do this. What you will need is two things.

  1. The GUID of your Price List. You can find this in the address bar of the price list in between the { } Brackets.
  2. The EXACT Name of your Price List. Remember, JavaScript is CASE Sensitive. So the best bet is for you to cut and paste the name in to the script.

Put this on your OnLoad Event for your Opportunity, Quote, Order or any other form you want this on.


     var CRM_FORM_TYPE_CREATE = 1;
     var CRM_FORM_TYPE_UPDATE = 2;
     switch (crmForm.FormType)
     var lookupData = new Array();
      //Create an Object add to the array.
      var lookupItem= new Object();
      //Set the id, typename, and name properties to the object = '{A0C40F17-DC1B-DF11-924E-001517C6CCD8}';
      lookupItem.typename = 'pricelevel'; = 'Main Price List';
      // Add the object to the array.
       lookupData[0] = lookupItem;
      // Set the value of the lookup field to the value of the array.
      crmForm.all.pricelevelid.DataValue = lookupData;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: