私のクエリは、account.name、account.account、account.parentaccountidを返します。queryexpressionとsilverlightを使用してアカウントからparentaccountidを取得する方法
私はSilverlightとCRM2011を使用しています。
今、parentaccountid属性から値を抽出する方法を見つけるのが難しいです。
私のVSプロジェクトにsilverlightextensionmethods.csファイルが含まれており、parentaccountid
から値を取得するのにGetAttributeValue<Guid>("parentaccountid")
を使用しています。
返される値は空です。
これを達成する方法はありますか?
他の属性値を取得できますが、アカウントのparentaccountidと連絡先のparentcustomeridが私の人生を非常に困難にしています。
コード:VALUES FORMの応答
void GetChildren_ExecuteCallBack(IAsyncResult childresult)
{
List<TreeRecord> listc = new List<TreeRecord>();
try
{
OrganizationResponse childresponse = ((IOrganizationService)childresult.AsyncState).EndExecute(childresult);
EntityCollection childresults = (EntityCollection)childresponse["EntityCollection"];
if (childresults.Entities.Count > 0)
{
TreeConfig sitm = new TreeConfig();
string sdisplay = "";
string[] fields = "".Split(';');
string sid = "";
string pid = "";
foreach (Entity childentity in childresults.Entities)
{
foreach (TreeConfig sitem in Configs)
{
if (sitem.EntityName == childentity.LogicalName)
{
sitm = sitem;
}
}
TreeRecord childitem = new TreeRecord();
string sValue = "";
sdisplay = "name;accountid;parentaccountid";
fields = sdisplay.Split(';');
sid = "accountid";
pid = "parentaccountid";
int i = sdisplay.Split(';').Length;
for (int j = 0; j < i; j++)
{
try { sValue += childentity.GetAttributeValue<string>(fields[j]) + " "; }
catch (Exception ex)
{
//s = "sValue haku: " + ex.Message.ToString();
//this.ReportMessage(s.ToString());
}
}
childitem.Name = sValue;
childitem.EntityName = childentity.LogicalName;
childitem.Level = sitm.Level;
childitem.ParentEntityName = sitm.EntityName;
childitem.Color = sitm.Color;
childitem.RecordId = childentity.GetEntityId<Guid>(sid);
try { childitem.ParentId = childentity.GetAttributeValue<Guid>(pid); }
catch
{
//sb.AppendLine("guid: parentid tietoa ei löydy");
//this.ReportMessage(sb.ToString());
}
listc.Add(childitem);
}
}
}
コードを表示してください。 – ccellar
最初に、私はQueryExpression – Jaana
を作成しましたが、すでにこれを述べています。あなたの質問を編集し、あなたが参照しているコードを挿入してください。そうでなければ誰もあなたを詳細に助けることができません。 – ccellar