I am trying to grab a list of invoices where *customerid*
is not null. I generate fetchxml query from advanced find and then put into a function of XRMServiceToolkit but it throws following exception.
Exception
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).
Code Snippet
Here is my code snippet.
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);
}
Your line should be var retrievedInvoices = XrmServiceToolkit.Soap.Fetch(query);
for fetch queries.