web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Error in calling Xrm.WebApi.retrieveMultipleRecords

(0) ShareShare
ReportReport
Posted on by 12,119 Moderator

Hi all, 

I am using below code:

//<-------------------- Ribbon Button Commands -------------------->
function clickSubmitBtn(recordID) {
debugger
Validate_POLines("msdyn_purchaseorder", recordID);
if (validate.isPOContainsLine) {
SetLookUp("msdyn_substatus", "msdyn_purchaseordersubstatus", "15818160-c7f9-e711-a829-000d3ab488e0", "Submitted");
Xrm.Page.data.entity.save();
}
}
//<-------------------- Ribbon Button Commands -------------------->

function Validate_POLines(entityLogicalName, guid) {
debugger;
var guidd = guid;
guid = guid.replace(/[{}]/g, "");
/*xrm.WebApi.retrieveRecord(entityLogicalName, guid, "?$select=msdyn_name&$expand=msdyn_purchaseorder($select=msdyn_purchaseorderproduct,msdyn_name)").then(
function success(result) {
//console.log('Retrieved values: Name: ${result.name}, Primary Contact ID: ${result.primarycontactid.contactid}, Primary Contact Name: ${result.primarycontactid.fullname}');
// perform operations on record retrieval
validate.isPOContainLine = true;
},
function (error) {
console.log(error.message);
// handle error conditions
}
);*/
//create the query
try {
//var queryOption = "?$select=msdyn_name&$filter=(msdyn_purchaseorder eq '" + guid + "')";
//var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder eq " + guid;
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder/id eq (guid'" + guid + "')";
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder/id eq (guid'" + guidd + "')";
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder/id eq " + guid;
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder/id eq " + guidd;
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder eq (guid'" + guid + "')";
var queryOption = "?$select=msdyn_name&$filter=msdyn_purchaseorder eq (guid'" + guidd + "')";
var queryOption = "?$select=msdyn_name&$filter=_msdyn_purchaseorder_value eq (guid'" + guid + "')";
var queryOption = "?$select=msdyn_name&$filter=_msdyn_purchaseorder_value eq " + guid;

//execute the query and get the results
Xrm.WebApi.retrieveMultipleRecords("msdyn_purchaseorderproducts", queryOption)
.then(function (data) {
//retrieveContactSuccess(data.entities);
validate.isPOContainsLine = true;
})
.fail(function (error) {
Xrm.Utility.alertDialog(error.message);
});
} catch (e) {
Xrm.Utility.alertDialog(e);
}
}

and having below errors:

Unrecognized 'Edm.String' literal 'guid'77EDFDE2-3DFC-E711-A829-000D3AB4831F'' at '25' in '(msdyn_purchaseorder eq (guid'77EDFDE2-3DFC-E711-A829-000D3AB4831F')'.

 

1. A binary operator with incompatible types was detected. Found operand types 'Microsoft.Dynamics.CRM.msdyn_purchaseorder' and 'Edm.String' for operator kind 'Equal'.

 

2. A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'.

 

3. error = XrmClientApi.ErrorResponse {errorCode: 0, message: "Unrecognized 'Edm.String' literal 'guid'891922C0-C…eq (guid'891922C0-CC43-E811-A834-000D3AB48E2A')'.", debugMessage: "", innerError: {…}, innerror: {…}}

I need help and this is urgent

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans