0
votes

In crm 2011, in an entity I have to retrieve the first name field from a custom entity through CRM Restkit. I am getting an error when I run the code. I think the 'filter' is wrong.

If it is system entity, then filter = "ContactId eq guid'"+Xrm.Page.data.entity.attributes.get('xyz' ).getValue( )[0].id+"'";

works fine.

But my case it is a custom entity with schema name 'new_student', I tried the filter = "new_student/Id eq guid'"+Xrm.Page.data.entity.attributes.get('xyz' ).getValue( )[0].id+"'"; which is not working.

So what should the filter be in my case

Regards, Vickram

1

1 Answers

0
votes

You probably should not use the entity name as the prefix in the filter, 'new_student/Id'. But that being said, I would suggest you "debug" this problem in few steps.

Start by opening the "new_student" JSON feed URL at the JSON endpoint to see that everything is valid for your custom entity through the web services, like:

http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet

Just replace the CRM server URL and instance name. When you get this path working and you see "results", continue adding the filter to the URL helping you to identify the field name and finding the correct filter faster:

http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet?$filter=Your_Schema_Field_Name eq 'Johnson'

and so on, then if you only need the first name you should add that to the $select to minimize the load of data coming from the JSON web-service:

http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet?$filter=Schema_Field_Name eq 'Johnson'&$select=FirstName

Hope it helps.