Is it a bug that will be solved soon? No, this is how it works from now on!
To the experienced consultants, there is no need to explain that Lookup fields in Dynamics 365, refer to a related entity. For years now we are used to remove values in a Lookup field manually. In addition to that, Microsoft introduced the ‘Remove Value’ button in an earlier version of Dynamics 365, which is accessible from the “Lookup More Records” pop-up.
In version 9 however, Microsoft introduced several user interface modifications which also resulted in a behaviour change of the “Remove Value” button that resulted in the above mentioned error messages. By using the ‘Remove Value’ button in version 9 the field is no longer emptied (e.g. NULL) but it becomes an empty array.
Our support ticket made some bells ring at Microsoft and they concluded that this is an unforeseen behaviour change. Microsoft decided not to change this unplanned new behaviour since version 9, but instead will update the Microsoft documentation online. From now on, officially, we have to check every Lookup for both NULL and an empty array as per example below.
This is how it used to work: formContext.getAttribute(‘dp_location’).getValue() != null
This is how it works from now on: formContext.getAttribute(‘dp_location’).getValue() != null &&
formContext.getAttribute(‘dp_location’).getValue().length > 0
Of course you can wait until Microsoft publishes the new documentation set, but they stated that the update of the documentation will at least take 3 to 6 months. So if you cannot wait that long and have any questions on this matter, send me an e-mail to email@example.com and we will support you. With the best interest for our customers in mind, we as competitors should act like colleagues and support each other.