Fetchxml 抛出异常以检查 guid 的非空值
Fetchxml throwing exception for checking not null values of a guid
我正在尝试获取 *customerid*
不为空的发票列表。我从高级查找生成 fetchxml 查询,然后放入 XRMServiceToolkit 的函数中,但它抛出以下异常。
异常
Error Code:-2147220989 Message: An exception System.FormatException was thrown while trying to convert input value 'not-null' to attribute 'invoice.customerid'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
代码段
这是我的代码片段。
function getinvoices()
{
var query = "<fetch mapping='logical' >"+
"<entity name='invoice'>"+
"<attribute name='name' >"+
"<attribute name='customerid' >"+
"<attribute name='statuscode' >"+
"<attribute name='totalamount' >"+
"<attribute name='invoiceid' >"+
"<order attribute='name' descending='false' >"+
"<filter type='and'>"+
"<condition attribute='customerid' operator='not-null' >"+
"</filter>"+
"</entity>"+
"</fetch>";
var retrievedInvoices = XrmServiceToolkit.Soap.RetrieveMultiple(query);
alert(retrievedInvoices.length);
}
对于提取查询,您的行应该是 var retrievedInvoices = XrmServiceToolkit.Soap.Fetch(query);
。
此提取查询在大多数节点中没有结束标记。试试这个:
<fetch mapping='logical' >
<entity name='invoice' >
<attribute name='name' />
<attribute name='customerid' />
<attribute name='statuscode' />
<attribute name='totalamount' />
<attribute name='invoiceid' />
<order attribute='name' descending='false' />
<filter type='and' >
<condition attribute='customerid' operator='not-null' />
</filter>
</entity>
</fetch>
我正在尝试获取 *customerid*
不为空的发票列表。我从高级查找生成 fetchxml 查询,然后放入 XRMServiceToolkit 的函数中,但它抛出以下异常。
异常
Error Code:-2147220989 Message: An exception System.FormatException was thrown while trying to convert input value 'not-null' to attribute 'invoice.customerid'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
代码段
这是我的代码片段。
function getinvoices()
{
var query = "<fetch mapping='logical' >"+
"<entity name='invoice'>"+
"<attribute name='name' >"+
"<attribute name='customerid' >"+
"<attribute name='statuscode' >"+
"<attribute name='totalamount' >"+
"<attribute name='invoiceid' >"+
"<order attribute='name' descending='false' >"+
"<filter type='and'>"+
"<condition attribute='customerid' operator='not-null' >"+
"</filter>"+
"</entity>"+
"</fetch>";
var retrievedInvoices = XrmServiceToolkit.Soap.RetrieveMultiple(query);
alert(retrievedInvoices.length);
}
对于提取查询,您的行应该是 var retrievedInvoices = XrmServiceToolkit.Soap.Fetch(query);
。
此提取查询在大多数节点中没有结束标记。试试这个:
<fetch mapping='logical' >
<entity name='invoice' >
<attribute name='name' />
<attribute name='customerid' />
<attribute name='statuscode' />
<attribute name='totalamount' />
<attribute name='invoiceid' />
<order attribute='name' descending='false' />
<filter type='and' >
<condition attribute='customerid' operator='not-null' />
</filter>
</entity>
</fetch>