2015-06-21 54 views
1

如何查詢SalesforceSharp中的查找字段?當我運行此查詢:在Force.com的開發者控制檯使用SalesforceSharp訪問查找字段

SELECT id, 
AccountId, 
Contact.Account.peaksyn_mm__Member_Family__c 
From Contact limit 2 

,peaksyn_mm__Member_Family__c是 「Y」 或 「N」。但是,當我與SalesforceSharp

var contact_records = client.Query<SFContact>(@"SELECT id, 
AccountId, 
Contact.Account.peaksyn_mm__Member_Family__c 
From Contact limit 2"); 

foreach (var r in contact_records) 
{ 
    Console.Log(r.id + ": " + (r.peaksyn_mm__Member_Family__c == null).ToString()); 
} 

與此類運行查詢

public class SFContact 
{ 
    public string id { get; set; } 
    public string AccountId { get; set; } 
    public string peaksyn_mm__Member_Family__c { get; set; } 
} 

r.peaksyn_mm__Member_Family__c是空的每一條記錄。我需要訪問Account對象中的字段嗎?

回答

2

你必須使用的,而不是r.peaksyn_mm__Member_Family__c

+0

這做到了r.account.peaksyn_mm__Member_Family__c。我修改了SFContact類爲: public class SFContact { public string id {get;組; } public string AccountId {get;組; } public SFAccount account {get;組; } } 訪問該屬性 – MarkF