Uncaught TypeError: Cannot read properties of undefined (reading 'startsWith') error on Native UI

Ashwini Jadhao
Giga Guru

Hi,

I am getting an console error as "Uncaught TypeError: Cannot read properties of undefined (reading 'startsWith')" whenever I am selecting "Type of Service" select box variable. UI Policy dependent on this variable are not working in Native UI but on portal all UI policies are working.

I have checked the treads from community and there are some suggestions as "If you only see it on a particular catalog item for example, you could easily search the script field of the scripts that run on that item for "startswith" to locate the offending script."

But in my case I have more that 150 UI policies and 100 client scripts then it is possible for me to check the issue by checking every script.

Is there any easy way to get the exact issue

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

did you try searching in catalog client script for your item or variable set if it contains startsWith

unless you find that script you cannot debug

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

I have check all client script from catalog item and I havn't used startWith

Hi,

Did you try to check using javascript debugger

Debugging Client Scripts

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

dmathur09
Kilo Sage
Kilo Sage

Hi SnowDev,

The easy way to search for a code in scripts.

1) In your filter navigator type studio and open the studio module.

2) Select any application

3) Click on search menu and then click on code search

4) Put your keyword in search term and make the "search in all application" checkbox as true and click on search.

This will search in your whole instance and you do not have to manually look for the keyword.

Hope this helps.

Regards,
Deepankar Mathur