How to write contains in a query?

Rithvik2
Tera Contributor

I have created a related list in the problem record like below screenshot...

It was working fine, but I need some modifications.. based on below logic.. I am comparing whether there is any similar short description is existed or not

but here I need to just check contains because everything will not match right?

and also one more point is.. based on that query I am getting self record under related list.. that I need to exclude.

find_real_file.png

1 ACCEPTED SOLUTION

Try with the below single query

current.addEncodedQuery('sys_id!='+parent.getValue('sys_id')+'^descriptionLIKE'+parent.description)

View solution in original post

7 REPLIES 7

Vasantharajan N
Giga Sage
Giga Sage

use like below
current.addEncodedQuery("short_descriptionLIKE"+parent.description);

or 

current.addQuery('short_description','CONTAINS',parent.description);


Thanks & Regards,
Vasanth

@Vasantharajan N 

I need to exclude self record in related list as well... can you help me with that query?

You meant request raised by current logged in user?


Thanks & Regards,
Vasanth

Anand Shukla
Mega Guru

Hi Rithvik,

You can use indexOf instead of Contains in an if condition and return as true based on your requirement.

OR

For example,

var v=[" Europe","England"];

if(v.contains("Europe"));

 

Mark it helpful and correct

Thanks

Anand