Tags as Subquery?

I have a table of contacts.

I would like to be able to filter these contacts based on a table filter, using values of a ContactTags model, and then using the selection as the value of a condition.

This condition would limit the Contacts to only contacts with that selected tag.

I just started down this path when I hit this error in a preview: 1. An error occurred while attempting to perform the following SOQL query: SELECT Id,GCP_Interest__c,Name,Birthdate,Account.Name,AccountId,CreatedDate FROM Contact WHERE (Id in (SELECT ItemId FROM ContactTag)) LIMIT 101 Error:Entity ‘ContactTag’ is not supported for semi join inner selects .

Is this a hard stop on one of Salesforce’s unqueryable objects, or am I approaching this the wrong way?

Thanks,

Jacob

I have the same question . . … any answer as yet?

This is indeed a hard stop because of a Salesforce limitation.   The object is queryable directly,  but not as a “semi join inner select” which means you can’t use it to filter the parent contact object.  You could build a table directly accessing the contact-tag object,  and even build a tag filter on that table - but you would end up with multiple records per contact (one record per contact / tag combination) and that’s not exactly what you want. 

Sorry about this. 

Do Topics get around this problem?

Joe…We were able to use Topics to filter a list of Tasks.  You need to create a child relationship from your object to Topics.  You will also need a model that brings back a list of Topics (i.e. the ‘tags’).  Then create a subquery join to Topics.  I’ve attached a screenshot of the trickiest part (the filter with subquery condition).


Yes,  Topics allow more query options than Tags do…