TypeError: Cannot read property toLowerCase of null when using AutoComplete widget

Hi, I'm encountering a error with the autocomplete widget and I'm not sure on how to solve it. It's very similar to https://community.mendix.com/link/questions/90638 and https://community.mendix.com/link/questions/87614 but I couldn't find an answer that solves my problem. For some users, no results are shown when opening the autocomplete widget, but for other users results are shown. I've tracked this down to (a combination of) the user roles a user has. When trying to reproduce this on an acceptance environment with the same version as production, the same set of user roles and a similar dataset (this might be important as we’re using some xpath constraints on our access rules) the error does not occur. The error I'm encountering is this: TypeError: Cannot read property 'toLowerCase' of null at request (widgets.js?636098976505785356:5374) at E.(/anonymous function).O.findMatches [as _findMatches] (https://diensten-connect.tvm.nl/widgets/widgets.js?636098976505785356:5390:17) at DecoratedClass.<anonymous> (mxui.js?636098976505785356:5) at DecoratedClass.MinimumInputLength.query (widgets.js?636098976505785356:19827) at DecoratedClass.query (widgets.js?636098976505785356:16638) at Select2.<anonymous> (widgets.js?636098976505785356:21391) at Select2.Observable.invoke (widgets.js?636098976505785356:16695) at Select2.Observable.trigger (widgets.js?636098976505785356:16685) at Select2.trigger (widgets.js?636098976505785356:21533) at Select2.open (widgets.js?636098976505785356:21553) When looking into the javascript (I'm no expert), I found the following lines of code where the error occurs: else{ if( attributeValue.toLowerCase().indexOf(self._currentSearchTerm.toLowerCase()) >= 0 ){ filteredObjs.push(self._localObjectCache[i]); } Any help with this is greatly appreciated! Kind regards, Mart
1 answers

Guess it could be solved by modifying the widget’s JavaScript to perform a check whether attributeValue is actually being set to a value other than null, something like 

// Check whether not not attributeValue = double negative becomes positive check :)  
// string.toLowerCase can only be called on string values so you need to typecheck it
if (!!attributeValue && typeof attributeValue === 'string'){
 {perform the rest of the code that does the lowerCase conversion etc.}
} else {