Subquery in reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 05:44 AM
Hi,
I have a subquery
javascript:'SUBQUERYsys_id,u_users_account,u_m2m_users_grps_users_acc^u_users_grps='+current.variables.group_id+'^EQ^ENDSUBQUERY^EQ'
Now here I want to fetch only active records from u_m2m_users_grps_users_acc.
where should i add?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 05:50 AM
did you try to append u_active=true?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 10:04 PM
@Ankur Bawiskar I tried which ratnakar suffested but it didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 05:52 AM - edited 05-08-2023 05:52 AM
Hi @Akki1 ,
You can add the condition for active records in the subquery itself by using an additional condition with an AND operator. Here's an example of how you can modify your subquery to fetch only active records:
javascript:'SUBQUERYsys_id,u_users_account,u_m2m_users_grps_users_acc^u_users_grps='+current.variables.group_id+'^EQ^u_m2m_users_grps_users_acc.u_active=true^AND^ENDSUBQUERY^EQ'
In the above subquery, we have added the condition u_m2m_users_grps_users_acc.u_active=true to fetch only active records. This condition is added with an AND operator to the existing condition using the ^AND^ separator.
You can modify the condition u_m2m_users_grps_users_acc.u_active=true as per your field name and condition requirements.
If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the ✅Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.
Thank you!
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 10:02 PM
@Ratnakar7 This doesn't work