How To Set Defaults to System Required Lookup Fields in Dynamics CRM

We recently developed a Dynamics CRM Solution for a client that tracks Sales Opportunities by units instead of by dollar values. This removed the need for a Price List; a system required field on the Opportunity. Users could save Opportunities, but they’d receive a warning at the top of the form calling out the missing price list.

Our first thought was to build a workaround by creating a Workflow on the creation of an Opportunity, which would auto-populate a “Default” Price List, but that Workflow failed to kick off properly.

We found a workaround using client-side code instead. First, we created a “Default” Price List in the Product Catalog. Then, we grabbed the GUID of the “Default” Price List for our code. (The following code occurs on the “onload” event of an Opportunity and sets the Price List to “Default”, removing the warning)

Function form_onload() {var value = new Array(); value[0] = new Object(); value[0].id = “40BF003C-74B3-E211-8921-005056A606B5”; //GUID of Price list value[0].name = “Default”; //name of Price List value[0].entityType = “pricelevel”; //object Xrm.Page.getAttribute(“pricelevelid”).setValue(value); } 

This approach can also be used for any other system required fields that you may not need!

This is just one example of how West Monroe Partners can help customize Dynamics CRM to best fit your company’s unique business needs. Contact us today with any additional questions you may have regarding Dynamics CRM customization.

Phone: 312-602-4000
Email: marketing@westmonroepartners.com
222 W. Adams
Chicago, IL 60606
Show Buttons
Share On Facebook
Share On Twitter
Share on LinkedIn
Hide Buttons