web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Custom API empty EntityCollection Request Parameter

(1) ShareShare
ReportReport
Posted on by 33
Hello!
 
I have build a Custom API with a required EntityCollection request parameter. One use case I have is to sent an empty array but I'm getting a strange error. 
  • When requesting with no parameter, it fails correctly. 
  • When requesting with the parameter, with at least one item, it works. 
  • When requesting with the parameter as as empty array, it errors with 'Object reference not set to an instance of an object.'
The only thoughts I have currently are that Dynamics picks the first item to understand the EntityCollection type but as there are no values it fails inelegantly. I tried setting the Logical Entity Name on the request parameter but I get an error where this can only be set for Entity and EntityReference types.   
 
I recognise one solution could be to make the parameter optional and optionally set it but that's more for the caller...
 
Why questions to the community are:
  1. Am I missing something here that would make it work? 
  2. Is this expected (logical) behaviour? 
  3. Are others able to repeat this? 
 
I was able to reprocess this in isolation.... 
 
 
 
 
I have the same question (0)
  • lvdk92 Profile Picture
    10 on at
    Hi, 
     
    We encounter the same problem, but our request parameter (EntityCollection) is optional.
    - When we make the request with no parameter, it continues the code correctly
    - When we make the request with the parameter, with at least one item, it continues the code correctly.
    - When we make the request with the parameter als an empty array, we get the error:  "Object reference not set to an instance of an object."
     
    Have you found the solution yet?
  • Verified answer
    tdashworth Profile Picture
    33 on at
    I raised this with MS support and the product group agreed this is a bug. They added it to their backlog and said it will take several months to get to but will keep me posted. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 53 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans