0

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

3 Answers 3

0

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

can you put the query you used finally?
0

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 + "'";

Read more

3 Comments

But the field name is vrp_contactid
@FaranSaleem see my update, also make sure you close all your SO questions by upvoting/accepting the answer that helped you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.