- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 12:34 AM - edited 10-18-2023 12:35 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 01:02 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 12:38 AM
Please share some screenshot for better understanding
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 01:00 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 01:02 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 04:20 AM
Thank you very much @livval! That worked.