Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Set a default pricelist in Microsoft CRM

0.00/5 (No votes)
19 Dec 2010 1  
If you do not want to deal with numerous pricelists, or you just want a fixed pricelist to be used, this code can help you.
When you start to use Microsoft CRM, you don't always want to hassle with the pricelist. Certainly not if you just want to input simple information.

Even later on, when you want to add *a lot* of information, you can use this snippet to lighten your load.

Add this code to the Form_Load-routine and/or the Form_Save-routine.

The latter will make sure that if the field is intentionally left blank, it is updated just before the save-action.

JavaScript
if(crmForm.all.pricelevelid.DataValue == null)
{
  //Create an array to set as the DataValue for the lookup control.
  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.
  // You should check your system for the actual ID.
  lookupItem.id = '07C0BC95-A8EF-DE11-A87B-00505681263E';
  lookupItem.typename = 'pricelevel';
  lookupItem.name = 'Standaard';
  // 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;
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here