简体   繁体   English

Salesforce SOQL查询和标签

[英]Salesforce SOQL Queries and Tags

I'm just getting started with the Salesforce Web Services API and I'm surprised that there isn't an obvious way to do a query for all eg Account objects that contain certain tags. 我刚刚开始使用Salesforce Web服务API,但令我惊讶的是,没有一种明显的方法可以对所有包含特定标签的Account对象进行查询。

What would you say is the best way to find all objects that contain certain tags? 您说什么是查找包含某些标签的所有对象的最佳方法?

I imagine it involves a join on Account.id and AccountTag.id or something similar, but despite some real research, I'm not sure how best to solve this problem. 我想它涉及到Account.id和AccountTag.id的联接或类似的联接,但是尽管进行了一些实际的研究,但我不确定如何最好地解决此问题。

Thanks in advance! 提前致谢!

Update: I guess I could do a select from AccountTag and then get the account objects based on ItemId, but the ideal would be to do a query on Account, with Tags being only one part of the criteria. 更新:我想我可以从AccountTag中进行选择,然后基于ItemId获取帐户对象,但是理想的方法是对Account进行查询,而Tag仅是条件的一部分。

You can use the SOQL-R style queries to do this, eg this will fetch the account Id and account Name for all the accounts with the internet tag. 您可以使用SOQL-R样式查询来执行此操作,例如,这将为所有带有internet标记的帐户获取帐户ID和帐户名称。

select item.id, item.name from accountTag where name='internet'

in this case the item relationship is to the account that was tagged, so you can select any field from the account object through the item relationship path. 在这种情况下,物料关系与被标记的帐户有关,因此您可以通过物料关系路径从帐户对象中选择任何字段。

See the SOQL-R docs for more info 有关更多信息,请参见SOQL-R文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM