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

Notifications

Announcements

No record found.

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
    2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 41 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 39

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans