web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How can i import ProjWorkerRecId in ProjJournalTrans table from an Excel file with three leading zeros?

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I am trying to import some data from Excel file to the ProjJournalTrans table. I have trouble with one specific field, and it is the ProjWorkerRecId. So far this is my code lines for that field:

  ProjWorkerRecId      employeeID;

   employeeID = any2real(strFmt("0000%1", any2int(cells.item(row, 4).value().double())));

   projJournalTrans.Worker              = employeeID;

My problem it that if for example, the Excel has the number "000013" in the cell for the worker ID, this code registers "13" in the table, which is translated to "unknown worker" and not "000013", which actually translates to an employee's name. What can I do to make the code register "000013" as it should?

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi MKyriakopoulou,

    The worker ID "000013" is not stored in a record ID. You need to find a PersonnelNumber (string value) and then find the worker record based on a string value. This worker record can return the record ID to be used on the journal transaction.

  • Community Member Profile Picture
    on at

    Hello André,

    Thank you so much for answering. I do not understand though, how do I do that? Do I have to replace " ProjWorkerRecId " in my code with "PersonelNumber"? I am sorry for this question, but I am a beginner in AX so I am a bit confused...

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi MKyriakopoulou,

    The HCMWorker table has a find method called findByPersonnelNumber(). It needs the personnel  number. This should be taken from the Excel file and then ensure you have the leading zeros. You can use this to get the HCMworker record. Then you can fill the worker field with the record ID of the HCM worker table.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans