Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

When fetching custom entity data "The given key was not present in the dictionary"

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I am using a web API to get the data of an entity and I am using postman to check the API working.

This is the API is am using:

{{base_url}}/api/data/v9.0/{{custom_entity_plural_name}}

But I am getting following response from the CRM.

{

    "error": {

        "code": "0x80040265",

        "message": "The given key was not present in the dictionary."

        ............. 

    }

}

I am using on-premises version of CRM. Same API is working fine when I try to fetch other entities like accounts, contacts, leads and opportunities.

Screenshot for reference:

pastedimage1660835776210v1.png

 

Kindly guide me on this. 

Thanks & Regards

  • Muhammad Shuja 1 Profile Picture
    Muhammad Shuja 1 20 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    I am using version 9 of crm dynamics (on premises).

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    What version of crm dynamics you have installed?

    May be your CRM version is not supported by Dataverse Rest Builder.

  • Muhammad Shuja 1 Profile Picture
    Muhammad Shuja 1 20 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi Bipin,

    Also tried with this:

    pastedimage1661250416612v1.png

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    Not sure why your url says localhost:

    It has to be https:\\orgname.domain.com\instancename

  • Muhammad Shuja 1 Profile Picture
    Muhammad Shuja 1 20 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    Tried it already.

    But getting following errors one by one:

    pastedimage1661164353191v1.png

    pastedimage1661164383311v2.png

    I tried on both Chrome and Edge but same response.

    Then I tried on internet explorer, I didn't get any above error in that case, but I get empty screen.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    Download managed solution from below link and install to your on premise instance

    github.com/.../releases

    This works for on premise instance too.

  • Muhammad Shuja 1 Profile Picture
    Muhammad Shuja 1 20 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi Bipin,

    It looks like this solution will work. I tried to install this on my local system and connect it with CRM cloud version and it works fine.

    But when I connect this to on-premises CRM. I am facing following issue.

    pastedimage1661161978419v1.png

    Connection to the CRM is also successful. But getting this error.

    I tried to look for the solution but didn't find it yet.

    Is there a way if we can install older version of DRB in XrmToolBox.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi,

    Try installing DRB tool on your instance to auto generate the code .

    carldesouza.com/.../

    You can check the exact URL from this tool.

  • Muhammad Shuja Profile Picture
    Muhammad Shuja 5 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi Matt,

    Thanks for the quick response.

     I tried with the suggested name "bcp_customerproductss" but get the same response.

    Then I executed this endpoint ("crmrooturl/api/data/v9.0") as you suggested. 

    This is the entity information:

    pastedimage1660848320990v2.png

    Kindly check this screenshot.

    Thanks & Regards

  • Suggested answer
    - Matt Bayes - Profile Picture
    - Matt Bayes - 890 on at
    RE: When fetching custom entity data "The given key was not present in the dictionary"

    Hi Muhammad,

    The issue usually comes up when the table you are referencing has a different name than what you expect.

    The API endpoint references the tables based on their collection name, not their plural name (in most cases it's the same but can be different).

    My thought is that instead of "bcp_customerproducts" it might be something like "bcp_customerproductss" because of the way Microsoft builds the collection name. If you wanted to confirm this, you can just open up CRM and navigate to the API endpoint ("crmrooturl/api/data/v9.0") and see if you can locate the "bcp_customerproducts" collection. You can do a search on the webpage (Ctrl + F) and locate it that way.

    Send a screenshot of the collection name if it does match what you are searching for, and we can figure out a solution from there.

    Thanks!

    Matt Bayes

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans