Related list to show cases with same first word in short description

j0unss
Tera Expert

Hi,

Is it possible to create related list which shows all the cases which has exactly the same first word in short description than case which is currently open? And am I able to show this list only when short description starts with predifined words?

 

What I am looking for is, that user should be able to see easily other related order tickets (same order number in short description) when he/she is handling service order case ie. short description starts with service order prefix.

1 ACCEPTED SOLUTION

livval
Tera Expert

Try this code in the Relationship:

(function refineQuery(current, parent) {
	// Add your code here, such as current.addQuery(field, value);
	var firstWord = parent.short_description.split(" ")[0];
	current.addQuery("short_description", "STARTSWITH", firstWord);
})(current, parent);

 

 

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@j0unss 

Please share some screenshot for better understanding

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

livval
Tera Expert

Hi.

 

It's difficult to say without examples, but try something like this in the Relationship:

(function refineQuery(current, parent) {
	// Add your code here, such as current.addQuery(field, value);
	var firstWord = parent.short_description.split(" ")[0];
	current.addQuery("short_description", "STARTSWITH", firstWord);
})(current, parent);

firstWord - splits the short_description of currently opened form into an array or words and takes the first word.

current.addQuery - adds a query for short description, which starts with the first word

livval
Tera Expert

Try this code in the Relationship:

(function refineQuery(current, parent) {
	// Add your code here, such as current.addQuery(field, value);
	var firstWord = parent.short_description.split(" ")[0];
	current.addQuery("short_description", "STARTSWITH", firstWord);
})(current, parent);

 

 

j0unss
Tera Expert

Thank you very much @livval! That worked.