【问题标题】:I am having some problems querying relationship within our schema using the SOAP API?我在使用 SOAP API 查询我们的模式中的关系时遇到了一些问题?
【发布时间】:2011-11-11 02:52:59
【问题描述】:
    I am trying to query the relationship "Assigned_To__r" within the "Case" object, so I can return the Name of the User that is currently assigned to the case.I have tried many different syntaxes, and read many different web pages on this, but can't seem to figure it out. Here is my current syntax that isn't working, but as I said, I've tried many different combinations 
Please help.


`select Id,CaseNumber,Subject,(select Name from Assigned_To__r) 
from Case 
where Closure_Code__c <> 'Invalid Support Case' 
and Closure_Code__c <> 'Duplicate Case' 
and Closure_Code__c <> 'Spam''

这是我得到的错误:

INVALID_TYPE: CaseNumber,Subject,(select Name from Assigned_To__r) from Case where ^

在 Row:1:Column:48 出现错误 不了解关系 查询调用的 FROM 部分中的“Assigned_To_r”。如果您试图 使用自定义关系,请务必在 自定义关系名称。请参考您的 WSDL 或描述 呼唤合适的名字。

【问题讨论】:

    标签: soql


    【解决方案1】:

    您的 SOQL 存在一些格式问题。

    如果您能阐明Assigned_To__c 自定义字段与Case 的关系,我可以更清楚地说明如何帮助解决您的问题。但是,根据我对您的情况的最佳猜测(具体来说,Closure_Code__c 是标准选项列表,Assigned_To__rCase 上的自定义子对父关系字段),我敢打赌您想要的 SOQL 看起来有点像像这样:

    SELECT Id, CaseNumber, Subject, Assigned_To__r.Name
      FROM Case
     WHERE Closure_Code__c NOT IN ('Invalid Support Case', 'Duplicate Case', 'Spam')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多