Dynamics CRM 2016: Do not retrieving account id using XRM Service Tool kit

会有一股神秘感。 提交于 2019-12-14 03:13:06

问题


In following code snippet I am trying to get child accounts if parent account id matched. It is populating the account name as expected such as ABC Title Company or Test Tile Co. but it populates account id as undefined.

I XRM Service Toolkit for retrieving the details of child account at CRM 2016. I don't know what went wrong in case of account id I double checked the spellings of the attribute but nothing get in favor.

functiongetChildAccounts(pAccountId)
{
var query =
            "<a:ColumnSet>" +
            "<a:AllColumns>false</a:AllColumns>" +
            "<a:Columns xmlns:b='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>" +
            "<b:string>name</b:string>" +
            "<b:string>accountid</b:string>" +
          "</a:Columns>" +
        "</a:ColumnSet>" +
        "<a:Criteria>" +
          "<a:Conditions />" +
          "<a:FilterOperator>And</a:FilterOperator>" +
          "<a:Filters>" +
"<a:FilterExpression>" +
  "<a:Conditions>" +
    "<a:ConditionExpression>" +
      "<a:AttributeName>parentaccountid</a:AttributeName>" +
      "<a:Operator>Equal</a:Operator>" +
      "<a:Values xmlns:b='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>" +
        "<b:anyType i:type='c:string' xmlns:c='http://www.w3.org/2001/XMLSchema'>"+ pAccountId +"</b:anyType>" +
      "</a:Values>" +
    "</a:ConditionExpression>" +
  "</a:Conditions>" +
  "<a:FilterOperator>And</a:FilterOperator>" +
  "<a:Filters />" +
"</a:FilterExpression>" +
          "</a:Filters>" +
        "</a:Criteria>" +
        "<a:Distinct>false</a:Distinct>" +
        "<a:EntityName>account</a:EntityName>" +
        "<a:LinkEntities />" +
        "<a:Orders />" +
        "<a:PageInfo>" +
          "<a:Count>0</a:Count>" +
          "<a:PageNumber>0</a:PageNumber>" +
          "<a:PagingCookie i:nil='true' />" +
          "<a:ReturnTotalRecordCount>false</a:ReturnTotalRecordCount>" +
        "</a:PageInfo>" +
        "<a:NoLock>false</a:NoLock>";

        var childAccounts = XrmServiceToolkit.Soap.RetrieveMultiple(query);

        alert(childAccounts[0].attributes['name'].value);
        alert(childAccounts[0].attributes['accountid'].id);
}

回答1:


For your piece of code you can use something like this, because is going to give you the id of the account.

alert(childAccounts[0].id);

You can use the debug and put a watch to get expression of the value.



来源:https://stackoverflow.com/questions/37190236/dynamics-crm-2016-do-not-retrieving-account-id-using-xrm-service-tool-kit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!