Reputation: 414
I have a entity with multiple records in it. The entity contains 3 fields Parameter Name, Parameter Value, and Contact ID. Contact ID is a lookup field. There are multiple records for a same Contact ID in my CRM Entity.
Now I want to fetch all Parameter Name and Parameter Value from CRM Entity based on the Contact ID.
I am using following code,
var Query = "$select=vrp_parametername&$filter= vrp_contactid eq '" + contactid + "'";
XrmSvcToolkit.retrieveMultiple({
entityName: entity ,
odataQuery: Query,
async: false,
successCallback: successCallback,
errorCallback: errorCallback
});
But I am getting following error,
Error has occurred in retrieving Response - Error: 400: Bad Request: No property 'vrp_contactid' exists in type 'Microsoft.Xrm.Sdk.Entity' at position 1
Upvotes: 0
Views: 1790
Reputation: 22836
You should use _vrp_contactid_value
var Query = "$select=vrp_parametername&$filter=_vrp_contactid_value eq '" + contactid + "'";
Update:
You can use the filter using single valued navigation property, refer my blog on same topic. There is another version of this query below:
var Query = "$select=vrp_parametername&$filter=vrp_contactid/contactid eq '" + contactid + "'";
Upvotes: 0
Reputation: 414
I was mixing the Schema Name with Logical Name in CRM in this case. I was using Schema Name in CRM which was why this error was coming.
What I did was simply used the Logical Name in this case and was able to achieved the desired result.
Thank you all for the help
Upvotes: 0
Reputation: 5531
Error clearly states that for that particular entity it could not find vrp_contactid field. Why don’t you check if field is available. Try using Crm restbuilder and see which condition attribute is available.
Upvotes: 0