Answered by:
CRM 2011 set picklsit value based on other picklist value

Question
-
Hi all:
I have 2 picklists, call them plA and plB. Both have 15 values, but the text is different between the 2, the first has a name, the 2nd a longer description. So if the user selects option 4 from plA, I need plB to be set to option 4 as well. I have tried the following code, but the alert I got is "Object[object]"
var plA = Xrm.Page.getAttribute("new_plA").getSelectedOption();
alert(plA.value);I was hoping to do something as simple as:
var plA = Xrm.Page.getAttribute("new_plA").getSelectedOption().value;
Xrm.Page.getAttribute("new_plB").setSelectedOption(plA);Can anyone give me any advice as to how I cna do this?
Thanks!
John.
Thursday, June 23, 2011 9:16 PMModerator
Answers
-
Hi,
You can refer the following blog posts to generate dependent pickists code instead of writting:
http://blogs.msdn.com/b/ukcrm/archive/2010/12/02/crm-2011-dependent-option-set-example.aspx
http://nishantrana.wordpress.com/2011/04/05/dependent-picklist-optionset-in-crm-2011/
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Thursday, June 23, 2011 9:47 PM
- Marked as answer by John StraumannModerator Friday, June 24, 2011 1:18 PM
Thursday, June 23, 2011 9:42 PM
All replies
-
Hi,
You can refer the following blog posts to generate dependent pickists code instead of writting:
http://blogs.msdn.com/b/ukcrm/archive/2010/12/02/crm-2011-dependent-option-set-example.aspx
http://nishantrana.wordpress.com/2011/04/05/dependent-picklist-optionset-in-crm-2011/
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Thursday, June 23, 2011 9:47 PM
- Marked as answer by John StraumannModerator Friday, June 24, 2011 1:18 PM
Thursday, June 23, 2011 9:42 PM -
Xrm.Page.getAttribute("new_plA").getValue();//Will get value of option
Xrm.Page.getAttribute("new_plA").getText();//Will get the text of option
Regards FaisalThursday, June 23, 2011 9:45 PM -
Thanks for the links, I modified Simon's code and got this working. However 3 of the fields I need to update are part of the header, and I am getting a "null" error in the JScript. I read somehow that fields in the header are separate from the form and thus not accessible via the OnChange JScript from a field on the main form. But I cannot believe that is true??Friday, June 24, 2011 1:16 PMModerator