Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

ODATA Patch / Update a field value of the entity key

(0) ShareShare
ReportReport
Posted on by 1,650

Hello,

I created a custom entity based on the table HcmPersonSkill. I'm trying to update the field "HcmPersonSkill.RatingLevelDate" via ODATA patch which is part of the primary key of the table as well as the entity key. Unfortunatly the update is not processed. I could not even see the new value from the JSON Body in the Debugger. Other fields like "HcmPersonSkill.Experience" are transferred and updated correctly and displayed in the variables in the debugger:

5226.pastedimage1665147924889v1.png

Do you have any idea why this value is not transferred?

Thanks

Sebastian

  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    ODATA Patch / Update a field value of the entity key
    Hi Sebastian,

    The Entity key for the standard entity HcmPersonSkillEntity is[PartyNumber, LevelType, HrmSkillLevelType and LevelDate]
    url/data/PersonSkills(PartyNumber='xx',LevelType=Microsoft.Dynamics.DataEntities.HrmSkillLevelType'yy',SkillId='zz',LevelDate=2023-12-22T12:00:00Z)

    Which means, that you can update any field except those 4 fields. If you want to change those fields, then you need to insert a new record.

    if for example, you use DMF to import into this entity, you'll notice that if you pass existing values for the combination of those 4 fields, an update will occur. However, if you make the value of one of those fields different than an existing value, then an insert will occur.

    So I think, if you want to update LevelDate, it needs to not be part of the entity key in ur custom entity. --try it and let us know please 

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    ODATA Patch / Update a field value of the entity key
    Try this way.
     
    Try updating entity from ssms. If it works, then do a post request to update the data.
  • JV13 Profile Picture
    JV13 12 on at
    ODATA Patch / Update a field value of the entity key
    @Sebastian, Did you get any resolution to this, I am also facing the same issue. Is there a way to update that date value in your example (or a field which is part of entity key) using odata patch call?
  • Sebastian Aurand Profile Picture
    Sebastian Aurand 1,650 on at
    RE: ODATA Patch / Update a field value of the entity key

    Thanks Martin for your response. The standard entity ("HcmPersonSkillEntity") shows the identical behaviour ("YearsOfExperience" is updated and "LevelDate NOT):

    pastedimage1665384486888v1.png

    Whereas in the UI of D365 you could change the "LevelDate".

  • Martin Dráb Profile Picture
    Martin Dráb 230,379 Most Valuable Professional on at
    RE: ODATA Patch / Update a field value of the entity key

    Does it work with the standard entity? If not, then we don't necessarily need to talk about your custom entity, because the problem can be demonstrated on the standard one. If it works there and not with your entity, the question is what you changed.

    By the way, RatingLevelDate isn't a part of the primary key of HcmPersonSkill table. The primary key is SurrogateKey, i.e. RecId.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans