tag:blogger.com,1999:blog-7483666954520465023.post8497095185836823395..comments2024-03-27T08:10:41.737+00:00Comments on Microsoft Azure & Dynamics 365 CRM -Learn The Ropes: How to Filter a Picklist / Option set based on another Picklist / Option set using Javascript in MS Dynamics CRM 2011D. MANJALYhttp://www.blogger.com/profile/16122189495637340566noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7483666954520465023.post-84135703593637858142018-08-16T11:53:51.127+01:002018-08-16T11:53:51.127+01:00Thanks for providing your information keep update ...Thanks for providing your information keep update and share with more things regarding Azure... <a href="https://onlineitguru.com/azure-online-training-placement.html" rel="nofollow">Azure Online Course Hyderabad</a>Anonymoushttps://www.blogger.com/profile/14157135109598143687noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-88811654323128535172014-01-29T10:46:28.075+00:002014-01-29T10:46:28.075+00:00Thank you very much from Germany!
I used this code...Thank you very much from Germany!<br />I used this code very easily on our crm 4.0!<br /><br />i just had to change this line "if (picklistTwo.Options[i].DataValue.substring(0, 3) != picklistOneSelectedValue)" i had to make a 1 out of the 3 and it works without hesitation (i guess because i used for the first 1, 2, 3,4 and for the second 11, 12, 21, 22 and so ;)<br /><br />so thanks very much works like a charm!Minervahttps://www.blogger.com/profile/06313393467211006001noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-87440088535123573692012-01-17T22:11:34.514+00:002012-01-17T22:11:34.514+00:00The approach you're recommending is an unsuppo...The approach you're recommending is an unsupported customization in CRM because you're referencing the form elements using the DOM instead of the CRM Client Script SDK. Why do you prefer this approach over the "Create Dependent Option Sets" sample in the SDK?<br /><br />http://msdn.microsoft.com/en-us/library/gg594433.aspxScotthttps://www.blogger.com/profile/11406910110884082082noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-50246201584137009412011-10-15T20:04:32.031+01:002011-10-15T20:04:32.031+01:00Hello Tim,
its all custom values. Even if you u...Hello Tim, <br /> its all custom values. Even if you use 101 102 etc for first option set its fine but the related option set should be defined accordingly. For instance...the second option set values 10101,10102 for the items of 101 and second option set values 10201, 10202,10203 etc for the items of 102. The idea is simple we are establishing some kind of identity for each option set and relate them based on the values. The first option set value is the prefix for second option set value.Hope its clear to you.D. MANJALYhttps://www.blogger.com/profile/16122189495637340566noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-16368557905257960852011-10-14T20:50:59.437+01:002011-10-14T20:50:59.437+01:00How will this function if picklistone has more tha...How will this function if picklistone has more than 9 options 100,200...900, can i then use 1000?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-35802046615145575552011-03-29T20:47:34.695+01:002011-03-29T20:47:34.695+01:00Hello Again Michael,
I think its just because
va...Hello Again Michael,<br /> I think its just because <br />var picklistTwoAttribute = "zy_newsubindustry";<br />var picklistOneAttribute = "zy_newprimaryindustry";<br />The attribute names must be in double quotes as we are referring it. Because of that document.getElementById couldn't find the attribute and its value. Please amend this and let me know whether you have any issues.D. MANJALYhttps://www.blogger.com/profile/16122189495637340566noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-75736239515943417302011-03-29T15:28:03.138+01:002011-03-29T15:28:03.138+01:00Greetings again. I wrote the code and put it in th...Greetings again. I wrote the code and put it in the OnChange for my "Primary Industry" field and keep getting zy_newprimaryindustry is undefined. Here is my code, do you know why this would be happening?<br /><br />function FilterOptionSet() <br />{<br /> var picklistTwoAttribute = zy_newsubindustry;<br /> var picklistOneAttribute = zy_newprimaryindustry;<br /> var picklistOne = document.getElementById(picklistOneAttribute);<br /> var picklistTwo = document.getElementById(picklistTwoAttribute);<br /><br /> var picklistOneSelectedValue = picklistOne.DataValue;<br /> if (picklistTwo.flag == true) <br /> {<br /> //a variable originalPicklistValues is used to retain<br /> // the original values of the picklist <br /> picklistTwo.Options = picklistTwo.originalPicklistValues;<br /> }<br /> else <br /> {<br /> picklistTwo.originalPicklistValues = picklistTwo.Options;<br /> picklistTwo.flag = true;<br /> //flag-to identify when the original picklist values to be reassigned <br /> }<br /><br /> if (picklistOneSelectedValue != null) <br /> {<br /> for (var i = picklistTwo.length - 1; i >= 0; i--) <br /> { <br /> if (picklistTwo.Options[i].DataValue != null && picklistTwo.Options[i].DataValue != "") <br /> {<br /> if (picklistTwo.Options[i].DataValue.substring(0, 7) != picklistOneSelectedValue) <br /> {<br /> picklistTwo.remove(i);<br /> //removes unrelated items and displays only related items.<br /> }<br /> }<br /> }<br /> }<br />}Mike Karlshttps://www.blogger.com/profile/11410911220828779959noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-87825095541319263032011-03-26T20:44:40.504+00:002011-03-26T20:44:40.504+00:00Hello Michael,
Thanks for reading my blog. Hope y...Hello Michael, <br />Thanks for reading my blog. Hope you got the point that we should bring some dependency between these two option lists by designing the values of the optionlist. Also we don't need to worry about the display text in the optionlist.<br />For instance value 100 in optionset1 - related values 10001, 10002 etc in optionset2.<br />Where as value 200 in optionset2 related values could be 20001, 20002 etc in optionset2<br />So 100, 200 will act as identifiers.Or you could call them as keys.The second optionlist is prefixed with these keys or identifiers.<br />Now coming to your case, you could have 7 digits for the optionlist1<br />So For instance<br />1000000<br />2000000<br />In that case 2nd optionlist should be designed with these keys<br />so it could be 100000001 , 100000002 which are related to identifier 1000000<br />and 200000001 ,200000002 etc for identifier 2000000<br />This design is important and as you said the code change is right in that case.<br />Normally CRM suggests values between 100 000 000<br />and 100 009 999 for the optionlist. But CRM will accept values between 0 and<br />2,147,483,646.<br />I hope this helps you.D. MANJALYhttps://www.blogger.com/profile/16122189495637340566noreply@blogger.comtag:blogger.com,1999:blog-7483666954520465023.post-61096355695805222292011-03-25T17:19:32.577+00:002011-03-25T17:19:32.577+00:00I cannot get this to work. I had to make my digits...I cannot get this to work. I had to make my digits out to 7 spots because of the solution prefix requirements.<br /><br />I added in my two option list field names under the "new_picklistone" and "newpicklisttwo" and changed the the 3 to a 7 for the substring, that should be it right?Mike Karlshttps://www.blogger.com/profile/11410911220828779959noreply@blogger.com