Microsoft Dynamics CRM 2011 doesn't have multi-select picklist controls available. The standard CRM picklist can only save one value in the database and it is not easy to extend this functionality. In addition, you have to deal with the Advanced Find Feature.

Original code came from Jim Wang (http://blogs.msdn.com/b/crm/archive/2009/03/31/crm-4-0-checkbox-style-mu...) but needed customization to work for MCRM 2011

Changes to original code:

var Name = Xrm.Page.data.entity.attributes.get("new_areaaccesstext");

Name.setValue(PLV.value);

  1. I added an "onClick()" event to build the string of values each time a checkbox is checked.
  2. The original code did not save it's values into the database when the "Save" button was clicked, so I added 2 additional lines of code to Set the values in the textbox and allow MCRM to save the data.
Microsoft Dynamics CRM Multi-Select Picklist

The script below will draw a checkbox style multi-select picklist control on the CRM form, and then get options from the real picklist attribute.

"Settings", "Customization", "Customize the System". Click "Web Resource" and then "New"

Type in the name of the Web Resource, Display Name...

Select "Script (JScript)" and choose the Language.

Click the Text Editor button and paste the code below to the source area on the form.

Click "OK" then "Save and Close"

Screenshot of the text editor in Microsoft Dynamics CRM

Go to "Settings", "Customization", "Customize the System". Expand "Entity" then expand "Account" and click "Forms"

Select the form where you added the picklist and textbox. And click "Form Properties" button

Add the new Web Resource to the Library by clicking the "Add" button, then select the new web Resource and click "OK"

In the Event Handlers section click "Add", select the Library file and enter the Function name (In our example: "AccountOnLoad") and click "OK" and "OK" again

  1. Controls - Create a picklist and populate it with values & a textbox to store the string of values selected from the picklist
  2. Put the picklist on the form where you want the new Multi Select Picklist to show up
  3. Create a web Resource:
  4. Add the event to the form:
  5. Save and Publish All Customizations

Here is the Sample code - You'll need to change the values new_areaaccess and new_areaaccesstext on lines 4, 5, 50, 51, and 63.

function AccountOnLoad () { // PL - the picklist attribute; PLV - used to save selected picklist values var PL = crmForm.all.new_areaaccess; //CREATE NEW PICKLIST var PLV = crmForm.all.new_areaaccesstext; //CREATE NEW TEXT FIELD TO STORE STRING PL.style.display = "none"; //HIDES THE CONTROL PLV.style.display = "none"; //HIDES THE CONTROL // Create a DIV container var addDiv = document.createElement("
"); PL.parentNode.appendChild(addDiv); // Initialise checkbox controls for( var i = 1; i < PL.options.length; i++ ) { var pOption = PL.options[i]; if( !IsChecked( pOption.text ) ) var addInput = document.createElement("" ); else var addInput = document.createElement("" ); var addLabel = document.createElement( "
Posted in:

Start a Project With Us

Submit your email below to get in touch with our team.