Uncaught TypeError: Cannot read properties of undefined (reading 'startsWith') error on Native UI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 12:08 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 12:11 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 12:15 AM
Hi Ankur,
I have check all client script from catalog item and I havn't used startWith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 12:17 AM
Hi,
Did you try to check using javascript debugger
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 12:22 AM
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