[英]How to retrieve 2 object fields from Salesforce using SOQL
I'm trying to retrieve 2 object fields using Salesforce queries SOQL Product我正在尝试使用 Salesforce 查询 SOQL 产品检索 2 object 字段
Both these objects have product Code = "CUCR05RC002"这两个对象都有产品代码 = "CUCR05RC002"
I want to combine these 2 queries我想结合这两个查询
Product2产品2
SELECT id
FROM product2
WHERE productcode = "CUCR05RC002"
PricebookEntry价目表条目
SELECT id
FROM pricebookentry
WHERE productcode = "CUCR05RC002"
Here is Product Page inside of it we have Price Book这是其中的产品页面,我们有价格手册
This is Price Book page have same Product Code as Product这是价格手册页面,产品代码与产品相同
Thanks谢谢
"bottom up" (from pricebook entry up to product) “自下而上”(从价目表条目到产品)
select Id, Product2Id, Product2.Id, Product2.Name
FROM PricebookEntry
WHERE productcode='CUCR05RC002'
"top down" (from product go down to related list of pricebook entries") “自上而下”(从产品 go 向下到价格手册条目的相关列表)
select Id, Name,
(select id from PricebookEntries)
FROM Product2
WHERE productcode='CUCR05RC002'
You use one or another depending on what you need.您可以根据需要使用一个或另一个。 Multiple products?
多个产品? All entries from 1 pricebook?
1 个价格手册中的所有条目?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.