
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 03:26 PM
Hello Community,
I've created a relationship where 'Applies to table' and 'Queries from table' are the same tables.
This query works.
current.addQuery('customer', parent.customer);
Next, I'd like to include or statement and query a list field
current.addQuery('customer', parent.customer);//or...
current.addQuery('customer', parent.u_related_customer);//u_related_customer list field
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 02:04 AM
try this once
current.addQuery('customer', parent.customer).addOrCondition('u_related_customer', 'LIKE', parent.customer);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 01:27 PM
current.addQuery('customer', parent.customer).addOrCondition('customer', 'LIKE', parent.u_related_customer.toString().split(','));
Valid? Do you see any issues with using this query?
Thank you,
Desmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 06:50 PM
looks good
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 08:14 PM
Somewhat related to this. How would I dot-walk (query) to a field in the customer [core_company] table, i.e. Customer ID [u_customer_ID]?
For example:
Queries from table: Contacts
I want to query the Customer field in the Contracts table
GlideRecord? How? Sample would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 09:48 PM
Hi,
you can dot walk the first field if that's reference one using
example
current.addQuery('company.name', 'IN', parent.field.name);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 07:39 AM
Hi,
The field is within the company table. Trying to get the value of a reference field's field, i.e. company.u_customer_id.
Regards,
Desmo