Quantcast
Channel: Sam's Activities
Viewing all articles
Browse latest Browse all 3363

How to select records using lookup fields for filter using webapi.

$
0
0

Hi,

I tried to select contacts where the account lookup id matches. the following API call works if I remove this 'and parentcustomerid eq '0C9A87ED-A4A0-EC11-B3FE-002248AD8D09' 

As soon as i put that line back, it returns an error. How i can add the account lookup field (parentcustomerid ) to the API call.

I am using the following code. 

function getContact( conId,orgId , formContext)
{

var Entity = "contact";
var Select = "?$select=fullname";
var Filter = "&$filter=contactid eq '3D36A874-49F6-EC11-82E5-002248AE4B85' and parentcustomerid eq '0C9A87ED-A4A0-EC11-B3FE-002248AD8D09'";

Xrm.WebApi.retrieveMultipleRecords(Entity, Select + Filter).then(
function success(result) {
if (result != null && result.entities.length > 0) {
formContext.ui.clearFormNotification("contactid");
} else{
formContext.ui.setFormNotification("The organization for the selected contact should be same as the organization of the ROD contact.", "ERROR", "contactid");
}

},
function (error) {
console.log(error.message);
}
);

}


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>