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 :
Finance | Project Operations, Human Resources, ...
Answered

updating position description getting error.

(0) ShareShare
ReportReport
Posted on by 1,559

Hi Friends,

All I want to do is updating a position description since people promoted for a new title. Title is stored in hcmpositiondetail table.

If I update it, it's going to create a new record and with updated valid from/to date.  But, it keeps throwing error "Cannot create a record in Position details (HcmPositionDetail). Invalid value specified for 'Expiration'. It cannot be less than the 'Expiration' of the last record."

So, what I did is just doing an insert, that worked for some positions. Some still get same error. Those position not working are those with multiple jobs in working history.

Following are part of code.

    if(HcmPositionDetail.Description !=positionName) //inserting new one
    {
        newHcmPositionDetail.job = HcmPositionDetail.job;
        newHcmPositionDetail.Position = HcmPositionDetail.Position;
        newHcmPositionDetail.Description   = positionName;
        newHcmPositionDetail.ValidFrom     = startDateTime;
        newHcmPositionDetail.ValidTo       = endDateTime;
        newHcmPositionDetail.validTimeStateUpdateMode(ValidTimeStateUpdate::CreateNewTimePeriod);
        newHcmPositionDetail.insert();

Can some one point out where is the problem?

I have the same question (0)
  • Suggested answer
    Ramit Paul Profile Picture
    22,803 Most Valuable Professional on at

    Hi,

    Can you share the position details form from UI?

    Select the position and manage changes- position details, position worker assignments and positions duration.

    Can you make some adjustment with correct date, and check if this helps.

    Note- everything you change or remove, those gets updated in the above fields in UI and table so you have to make sure from there all are correct.

    If needed, you can delete some lines and try ( try in dev or test env).

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ganriver,

    I think updating is a better option. For an update, you don't need to provide the validFrom and ValidTO dates. Try setting the ValidTimeStateUpdateMode to ValidTimeStateUpdate::Correction.

  • Ganriver1 Profile Picture
    1,559 on at

    Hi Gunjan,

    I need to provide validFrom since it's starting date of new position. ValidTO is just the max datetime. I will try your suggestion.

    Many thanks,

    River

  • Ganriver1 Profile Picture
    1,559 on at

    Hi Ramit,

    That's good suggestion, I'd like to see how UI doing update.

    Many thanks,

    River

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi River,

    You should be able to update the ValidFrom field as well. Please try and let me know if it works.

  • Ganriver1 Profile Picture
    1,559 on at

    Hi Gunjan,

    ValidTimeStateUpdate::Correction did the trick.

    Thank you so much!

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 653

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 493 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 317 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans