Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Cannot create a record in Employment (HcmEmployment).

Posted on by Microsoft Employee

Whenever I am trying to insert a record in HcmEmployment table through a .csv file, it is giving following error in infolog.

Cannot create a record in Employment (HcmEmployment). Invalid value specified for 'Employment end date'. It cannot be greater than or equal to the 'Employment end date' of the first record.

I finally deleted all the records from HcmEmployment table and only tried to insert one record, but it is stikll showing the above error.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Hi Syed,

    We are importing Employee and Contractors through DIXF in Dynamics 365.

    Some of the records have error as below.

    "Results. Cannot edit a record in Employment (HcmEmployment). 'Employment start date' can only be updated to today or a value in future in change tracking mode. "

     

    HCM.png

    Could you please suggest, what could be the reason.

    Thanks,

    Kiran 

  • Suggested answer
    syed baber Profile Picture
    syed baber 11,627 on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Hi Mahesh,

    I would not recommend you to change this property in HcmEmployment table. This could impact the functionality, whereever this table is being used in the system. Instead, I would suggest you to insert the records in HcmEmployment table similar to the manual creation of records when you try to enter data through Forms. You can query the last date effective record and then insert the next record based on fromDate and ToDate of last record. To better understand the read and write operations in Date Effective table, have a look at below post:

    msdn.microsoft.com/.../gg843767.aspx

    Please verify and let me know if you have further queries.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    To both Baber and Sohaib,

    Now I somewhat understood the way the HCMEmployment table is taking data particularly for ValidFrom and ValidTo dates.

    But the requirement of the client is that we need to insert data as per there requirements.

    How can I achieve this?

    I guess

    For the

    HcmEmployment_AK1 Index in HcmEmployment Table, I need to change following properties?

    ValidTimeStateMode=NoGap ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Okay I will check Baber.

  • Suggested answer
    syed baber Profile Picture
    syed baber 11,627 on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Hi Mahesh,

    Do you mean that you have more fields in your import file thant what is available in the staging table? You can add more fields to the staging table and can map that to target entity.

    Please let me know if you have further queries in this regard.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Yes Baber I tried to use DIXF framework

    But the problem with this framework is I was not getting all the fields in the staging table?

    Same problem with my colleague to.

    Finally my manager said me to use X++.

    So I went to it only.

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Hi Mahesh,

    Why are you not using Data import export framework to import records into HcmWorker? The DIXF framework will take care of all validations.

    Please let me know if you need any help related to that.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Thanks Sohaib I will check it. I don't know why Google is not displaying this search result .

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Cannot create a record in Employment (HcmEmployment).

    although focus should be to resolve original problem, despite here goes the code to create employee

    community.dynamics.com/.../155550

    you can extend it as per your need

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Cannot create a record in Employment (HcmEmployment).

    Baber. Do you have any code to import Employee data into dynamics using X++ like HCMWoker and so on.

    The links we have in Google are very less like Krishnablogspot and all.

    If possible please help.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans