使用SalesforceSharp访问查找字段

时间:2015-06-21 05:48:59

标签: salesforce force.com

如何在SalesforceSharp中查询查找字段?当我运行此查询时:

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

在Force.com的开发者控制台中,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对象中的字段吗?

1 个答案:

答案 0 :(得分:2)

你必须使用r.account.peaksyn_mm__Member_Family__c而不是r.peaksyn_mm__Member_Family__c