This was the third consecutive BUG which I faced in the last few weeks back-to-back. In one of my Previous Blog I discussed about the Dependent PickList / OptionSet solution provided in MSDN which could be very useful and was working fine with my Contacts entity.
I actually wanted to replicate the same functionality within Cases too so that during selection of Customer the Service Representative must be aware of the respective Customer Category and Sub-Category as well. I followed the exact same steps and configured properly the Dependent Picklist Solution. When I first opened the new case then it worked fine as expected.
But after saving the values under Category and Sub-Category when I reopened the case; then it showed an error popping up on the screen saying:-
For a second I thought I might have missed something, so rechecked all the settings but all were configured perfectly as described in MSDN. For a detailed description I opened the same under I.E. and found out a different error screen popping up on the screen:-
Error:- ‘this.get_editView()’ is null or not an object.
I then made up my mind to get deeper into the issue and check for the real cause. I used the debugger and found out that the jScript “Controls.clearOption()” was actually throwing the error.
I went more deeper into this and it took me to “this.get_editView().get_editElement().children().remove()”. I Added “this” under the Watch to keep up with the changes.
Next time when I went a step more into this, it was actually trying to return the value under this.$4_0. But the value was actually null, hence was the Error message:- ‘this.get_editView()’ is null or not an object.
Now this ($4_0) came out from nowhere; No idea as what was happening since last couple of weeks between CRM and Me. 😛
I Google out about this Issue and figured out that I was not the only one facing this Issue. The same issue has been discussed over here as well.
Now since my deliverable timeline was very narrow; so I had to find out a way to get this working again. I did some RnD with this for couple of hours and figured out a nice workaround.
Workaround:- Somehow the Child-field control was missing the value under ($4_0) hence I captured the field control once again under a variable and called the clearOptions() method on the freshly captured control. And guess what, It actually worked !!!😀
Result:- I used the debugger again and found out; this time the value existed for $4_0 on freshly captured Control.
I have logged this Issue under Microsoft Connect. If you are also facing same or came across similar Issue then request to kindly vote for it on the link provided below.
Finally after 3 Months conversation with MS, they have agreed that its a BUG !!!
Now till the time it gets freezes by Microsoft, I guess this workaround will save a lot of time.
Hope this was Helpful.