Shamma Negi
Kilo Sage

Hi All,

 

I have found this wherein the indexOf function return different results in different scenario. Please have a look at below scenarios:

 

 

Example 1 :

 

When the watch list is null on this record which I used. Then it returns this error. 

 

ShammaNegi_0-1702567079539.png

 

 

Output:

ShammaNegi_1-1702567093435.png

 

Note : If you are trying to search something via indexOf function in some field and the field is null then it return this error and it doesnt run the code. Make sure when the field is blank always add the below lin in your code:

 

if(grcase2.watch_list != "")

 

Example 2:

 

When the watch list field contains 2 values then it works perfectly fine the same code. So its not the error in the code however indexOf works as expected in null vs not null field values.

 

ShammaNegi_4-1702567275682.png

 

 

 

Output: 

ShammaNegi_3-1702567269283.png

I found this really helpful.

Hope it helps you as well.

 

I hope this article helpful. Please mark it as helpful and bookmark if you like it.

 

Regards,

Shamma Negi