Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

deep insert custom entities 1:n relationship odata api

Posted on by 20

Hi,

I have a problem inserting 1:n relation entity using odata api. I have two entities: submissions, and claims. I want to create submission and multiple claims with one post. I understand it can be done using deep insert, but, it does not work in my case.If I insert submission entity only, it works (if i remove everything from line 7 to 12 it works).

5672.pastedimage1597899222825v2.png

relationship print screen

7356.pastedimage1597899443998v3.png

Thanks,

Max

  • MaxRy Profile Picture
    MaxRy 20 on at
    RE: deep insert custom entities 1:n relationship odata api

    That was it. Naming of the fields. It works now, thank you very much for the tip.

  • Roma Gupta Profile Picture
    Roma Gupta 725 on at
    RE: deep insert custom entities 1:n relationship odata api

    Hi MaxRy

    Is the document number being used in your screenshot unique? Does this work for the first time including lines 7 to 12?

    Regards

    Roma

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: deep insert custom entities 1:n relationship odata api

    Hi Max,

    It might be caused by fieldname of your child entity(Claim) is not correct:

    The field name is case sensitive, e.g:

    I have a custom entity Country, and the relationship between Country and Contact is 1:N,

    When creating a Country with multiple contacts, if my data is something like below:

    {
    "new_name": "Clofly Republic",
    "new_new_country_contact_Country": [
            {
                "Firstname": 'Clofly',
                "Lastname": 'Mao'
            }
        ]
    }

    As you can see, fields of Contact entity are "Firstname" and "Lastname", then I encountered same error if I keep the wrong name.

    After changing them to firstname and lastname, it works.

    Therefore, I suggest you could change dsl_DocumentNumber, dsl_ServiceType to dsl_documentnumber and dsl_servicetype to test again.

    Regards,

    Clofly

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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans