Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Custom API empty EntityCollection Request Parameter

(1) ShareShare
ReportReport
Posted on by 6
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.... 
 
 
 
 

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans