Dynamics CRM 2016:不要使用 XRM 服务工具包检索帐户 ID [英] Dynamics CRM 2016: Do not retrieving account id using XRM Service Tool kit

查看:20
本文介绍了Dynamics CRM 2016:不要使用 XRM 服务工具包检索帐户 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下代码片段中,如果父帐户 ID 匹配,我将尝试获取子帐户.它按预期填充帐户名称,例如 ABC Title CompanyTest Tile Co.,但将帐户 ID 填充为 undefined.

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.

XRM 服务工具包,用于在 CRM 2016 中检索子帐户的详细信息. 我不知道在帐户 ID 的情况下出了什么问题,我仔细检查了属性的拼写,但没有任何结果.

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);
}

推荐答案

对于你的一段代码,你可以使用这样的东西,因为它会给你帐户的 id.

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

警报(childAccounts[0].id);

alert(childAccounts[0].id);

您可以使用调试并放置手表来获取值的表达式.

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

这篇关于Dynamics CRM 2016:不要使用 XRM 服务工具包检索帐户 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆