Question Status

Verified
Doug Coates asked a question on 22 Mar 2015 10:20 PM

Hi,

I have created a dependant picklist (PL2) that is populated by a subset of the original options assigned to it when the user makes a selection in the primary picklist (PL1) i.e. when PL2 was initially created as a field on the form approx. 45 options were added. When the user selects from PL1 then PL2 is cleared and PL2 is populated with a small number of options depending on the selection made in PL1.

However, there is always a blank option as part of the option set for PL2 which I don't want. In code I can assign an option (from the existing subset) but the blank one is always there and generates a 'null' error if the user selects it (when some subsequent 'on_change' code is run). Can trap this error with try/catch but would rather the user shouldn't have the option of selecting the 'blank' in the first place.

This field is customised so that it is by default assigned a value rather than the blank (no selection) option.

-----

Any suggestions re how I can remove/avoid having the blank option would be appreciated.

Doug.

Reply
Suggested Answer
Bruno Lucas responded on 22 Mar 2015 10:31 PM

Picklist or options set. Are you on CRM 4 or higher?

here it is how to do it on 2011 or higher:

community.dynamics.com/.../112629.aspx

Bruno Lucas, Senior CRM Consultant

DynamicDay CRM Blog 

Please mark my post as "Verified" If it helped to solve your problem 

Reply
Doug Coates responded on 22 Mar 2015 10:44 PM

Thanks Bruno - I followed the link.

I'm on CRM 2013 and added the line as the line it suggested but don't know what the Option number is for the blank...

Xrm.Page.getControl("new_optionset").removeOption(???????);

How do I find this out? If I click on it it generates an error - trapping the error doesn't tell me the number for the blank option.

Doug.

Reply
Verified Answer
Bruno Lucas responded on 22 Mar 2015 10:59 PM

Hi Doug

that option is set to ""

so try Xrm.Page.getControl("new_optionset").removeOption("");

Bruno Lucas, Senior CRM Consultant

DynamicDay CRM Blog 

Please mark my post as "Verified" If it helped to solve your problem 

Reply
Doug Coates responded on 22 Mar 2015 11:03 PM

"Yes" - that did it - great! Thanks so much for your answer.

Doug.

Reply
Verified Answer
Bruno Lucas responded on 22 Mar 2015 10:59 PM

Hi Doug

that option is set to ""

so try Xrm.Page.getControl("new_optionset").removeOption("");

Bruno Lucas, Senior CRM Consultant

DynamicDay CRM Blog 

Please mark my post as "Verified" If it helped to solve your problem 

Reply
Suggested Answer
Bruno Lucas responded on 22 Mar 2015 10:31 PM

Picklist or options set. Are you on CRM 4 or higher?

here it is how to do it on 2011 or higher:

community.dynamics.com/.../112629.aspx

Bruno Lucas, Senior CRM Consultant

DynamicDay CRM Blog 

Please mark my post as "Verified" If it helped to solve your problem 

Reply