Add the following code within a web resource:
function setPriceList() { //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. lookupItem.id = '{<GUID_OF_PRICELIST>}'; lookupItem.typename = 'pricelevel'; lookupItem.name = 'Default'; // Add the object to the array. lookupData[0] = lookupItem; // Set the value of the lookup field to the value of the array. Xrm.Page.getAttribute("pricelevelid").setValue(lookupData); } function setCurrency() { //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. lookupItem.id = '{<GUID_OF_CURRENCY>}'; lookupItem.typename = 'transactioncurrency'; lookupItem.name = 'US Dollar'; // Add the object to the array. lookupData[0] = lookupItem; // Set the value of the lookup field to the value of the array. Xrm.Page.getAttribute("transactioncurrencyid").setValue(lookupData); }
Then, add a Form OnLoad event handler for each of the above functions, setPriceList()
and setCurrency()
. You can find the GUID_OF_PRICELIST
from the URL of the price list edit page:
https://your.crm.server/main.aspx?etc=1022&extraqs=%3fetc%3d1022%26id%3d%257bXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX%257d%26pagemode%3diframe%26preloadcache%3d1370545259423&pagetype=entityrecord
You can also find the GUID_OF_CURRENCY
from the URL of the currency edit page:
https://your.crm.server/biz/transactioncurrencies/edit.aspx?id=%7bXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX%7d#