Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Data management package REST API: How to auto-generate PersonnelNumber?

(0) ShareShare
ReportReport
Posted on by 10

I have been trying to import an employee data package via the Data management API, with the following content:

Manifest.xml

<DataManagementPackageManifest xmlns:i="">www.w3.org/.../XMLSchema-instance" xmlns="">schemas.microsoft.com/.../DataManagement">
  <DefinitionGroupName>Descriptionc</DefinitionGroupName>
  <Description></Description>
  <PackageEntityList>
    <DataManagementPackageEntityData>
      <DefaultRefreshType>FullPush</DefaultRefreshType>
      <Disable>false</Disable>
      <EntityMapList>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>PERSONNELNUMBER</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsDefaultValueEqualNull>false</IsDefaultValueEqualNull>
          <IsAutoGenerated>true</IsAutoGenerated>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>PERSONNELNUMBER</XMLField>
        </EntityMap>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>EMPLOYMENTLEGALENTITYID</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsAutoGenerated>false</IsAutoGenerated>
          <IsDefaultValueEqualNull>false</IsDefaultValueEqualNull>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>EMPLOYMENTLEGALENTITYID</XMLField>
        </EntityMap>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>FIRSTNAME</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsAutoGenerated>false</IsAutoGenerated>
          <IsDefaultValueEqualNull>true</IsDefaultValueEqualNull>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>FIRSTNAME</XMLField>
        </EntityMap>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>NAMEALIAS</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsAutoGenerated>false</IsAutoGenerated>
          <IsDefaultValueEqualNull>true</IsDefaultValueEqualNull>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>NAMEALIAS</XMLField>
        </EntityMap>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>EMPLOYMENTSTARTDATE</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsAutoGenerated>false</IsAutoGenerated>
          <IsDefaultValueEqualNull>false</IsDefaultValueEqualNull>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>EMPLOYMENTSTARTDATE</XMLField>
        </EntityMap>
        <EntityMap>
          <ArrayIndex>0</ArrayIndex>
          <EntityField>EMPLOYMENTENDDATE</EntityField>
          <EntityFieldConversionList i:nil="true"></EntityFieldConversionList>
          <IsAutoDefault>false</IsAutoDefault>
          <IsAutoGenerated>false</IsAutoGenerated>
          <IsDefaultValueEqualNull>false</IsDefaultValueEqualNull>
          <UseTextQualifier>false</UseTextQualifier>
          <XMLField>EMPLOYMENTENDDATE</XMLField>
        </EntityMap>
      </EntityMapList>
      <EntityName>Employee</EntityName>
      <EntityTransformList i:nil="true"></EntityTransformList>
      <ExcelSheetName></ExcelSheetName>
      <ExecutionUnit>1</ExecutionUnit>
      <FailExecutionUnitOnError>true</FailExecutionUnitOnError>
      <FailLevelOnError>true</FailLevelOnError>
      <InputFilePath>Data.csv</InputFilePath>
      <LevelInExecutionUnit>1</LevelInExecutionUnit>
      <RunBusinessLogic>true</RunBusinessLogic>
      <RunBusinessValidation>true</RunBusinessValidation>
      <SampleFilePath></SampleFilePath>
      <SequenceInLevel>1</SequenceInLevel>
      <SourceFormat>CSV-Unicode</SourceFormat>
      <TargetEntity>HcmEmployeeEntity</TargetEntity>
      <ValidationStatus>Yes</ValidationStatus>
    </DataManagementPackageEntityData>
  </PackageEntityList>
  <ProjectCategory>0</ProjectCategory>
  <RulesData i:nil="true"></RulesData>
</DataManagementPackageManifest>


Data.csv

EMPLOYMENTLEGALENTITYID,FIRSTNAME,NAMEALIAS,EMPLOYMENTSTARTDATE,EMPLOYMENTENDDATE
dat,Test987650,Test987654,2020-02-02,2024-02-02
dat,Test987651,Test987653,2020-02-02,2024-02-02

It always fails I believe because PersonnelNumber is not specified (if I specify PersonnelNumber, it imports succesfully), but this does not make sense to me.
Are clients supposed to generate PersonnelNumber manually? How do we guarentee that the PersonnelNumber we generate is unique?
Does anyone have a working data package for importing employees?
Lastly, I noticed that there is a AutoGenerate field in the field maps (it has no effect as far as I have tested), but is there any API to check if a field is auto-generated or not?

  • MathewR Profile Picture
    MathewR 10 on at
    RE: Data management package REST API: How to auto-generate PersonnelNumber?

    In the Manifest.xml file above, I have set:

             <IsAutoGenerated>true</IsAutoGenerated>

    For PERSONNELNUMBER. Is that not enough?

  • AnithaEswaran Profile Picture
    AnithaEswaran 2,032 on at
    RE: Data management package REST API: How to auto-generate PersonnelNumber?

    Hi,

    It depends on the set up in F&O.

    If the personnel number is set as manual, it will accept the values passed. If it is as AutoGenerated in the number sequence , then empty values will throw error.

    I suggest you to enable 'Auto Generated' in Entity mapping .

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans