Subquery in reference qualifier

Akki1
Tera Contributor

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?

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Akki1 

did you try to append u_active=true?

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

@Ankur Bawiskar  I tried which ratnakar suffested but it didn't work

Ratnakar7
Mega Sage
Mega Sage

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

Akki1
Tera Contributor

@Ratnakar7 This doesn't work