
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:06 AM
Hi All
We have a UI action on the incident table that we need to restrict access to for only records with a correlation_display that starts 'MSFT'.
The condition I'm using is 'current.correlation_display.indexOf('MSFT')==-1' but this is removing the UI action from all records regardless of correlation_display.
Any help would be appreciated
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:09 AM - edited ‎01-29-2025 02:11 AM
Hi,
-1 is when you don't find the string at all, you need to use the below
current.correlation_display.toString().indexOf('MSFT')==0
OR Simply
current.correlation_display.startsWith('MSFT')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:09 AM - edited ‎01-29-2025 02:10 AM
try this
current.correlation_display.toString().startsWith('MSFT')
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:09 AM - edited ‎01-29-2025 02:11 AM
Hi,
-1 is when you don't find the string at all, you need to use the below
current.correlation_display.toString().indexOf('MSFT')==0
OR Simply
current.correlation_display.startsWith('MSFT')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:13 AM
Hello @Steve29 ,
Please follow the below condition. It might help.
current.correlation_displaySTARTSWITHMSFT
Please mark my answer as accepted solution and give thumbs up, if it helps you.
Regards,
Abhishek Thakur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2025 02:21 AM
your above code won't work as it's with wrong syntax.
Please refer here for the correct syntax
JavaScript String startsWith()
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader