2014-08-29 16 views
0

我運行在Salesforce下面的查詢,以獲得國家Salesforce的不讓從關係找到的國家,但允許名稱和ID

SELECt name, owner.country from lead 

這提供了以下錯誤:

No such column 'country' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. 

然而這工作得很好,如果我做

SELECt name, owner.id from lead 
SELECt name, owner.username from lead 
SELECt name, owner.name from lead 

它使數據

回答

0

這是由於多態關係造成的。如果您仔細閱讀了您收到的錯誤,您可能已注意到該實體爲Name,這不是User(正如我以前預計的那樣)。 The Name對象用於從相關記錄中檢索相關記錄可能來自多個對象類型的信息。

For example, the owner of a case can be either a user or a group (queue)

WhoWhatOwner關係字段將被用來訪問這個Name對象和它不能被直接訪問。並且你得到的錯誤是由於這個Name實體沒有一個字段country,你可以在文檔中看到。

相關問題