我创建了 (1) 2 个帐户(第一个将成为第二个帐户的父级)(2) 创建了 2 个联系人(关联第一个联系人将是第一个帐户,第二个联系人将是第二个帐户)(3) 创建了一个笔记并将其与父级关联帐户 (4) 创建了两个注释并将其与第二个联系人相关联
现在我想在单个查询中检索所有记录..
我试过但没有得到结果..
var fetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
"<entity name='account'>" +
"<attribute name='name' />" +
"<attribute name='primarycontactid' />" +
"<attribute name='telephone1' />" +
"<attribute name='accountid' />" +
"<order attribute='name' descending='false' />" +
"<link-entity name='contact' from='parentcustomerid' to='accountid' link-type='inner' alias='bd'>" +
"<attribute name='fullname' />" +
"<link-entity name='annotation' from='objectid' to='contactid' link-type='inner' alias='be'>" +
"<filter type='and'>" +
"<condition attribute='subject' operator='not-null' />" +
"</filter>" +
"</link-entity>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
EntityCollection Coll = CrmConn.RetrieveMultiple(new FetchExpression(fetch));
foreach (Entity acunt in Coll.Entities)
{
Console.WriteLine("Name of Account: " + acunt.GetAttributeValue<string>("name"));
Console.WriteLine("Name of Contact: " +acunt.GetAttributeValue<string>("fullname"));
Console.WriteLine("Name of Notes: " + acunt.GetAttributeValue<string>("subject"));
//Console.WriteLine("contact: ", Coll.Entities[]);
}
它只显示帐户名不显示注释和联系人
至尊宝的传说
相关分类