UI Action Condition

Steve29
Tera Expert

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

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

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')

 

 

-Anurag

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Steve29 

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.

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

Anurag Tripathi
Mega Patron
Mega Patron

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')

 

 

-Anurag

Abhishek_Thakur
Mega Sage

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

 

@Abhishek_Thakur 

your above code won't work as it's with wrong syntax.

Please refer here for the correct syntax

JavaScript String startsWith() 

AnkurBawiskar_0-1738146050240.png

 

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