Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Error "Worker staging failed" while creating HcmWorker through X++

(3) ShareShare
ReportReport
Posted on by 466
Hello:
 
I'm running the below code in a development environment, the goal of which is to create a new HcmWiorker. The issue I'm running into is I get this error at the point where newHireHcmWorkerV2() is called.
 
Worker staging failed! :: The ConnectionString property has not been initialized. :: [90323 - Test, Test]
 
HcmEmployment lclHcmEmployment;
HcmPosition lclHcmPosition;
 
HcmPersonnelNumberId empid = HcmWorker::getNewPersonnelNumber();
personName = this.createPersonName(firstName, middleName, lastName);
 
HcmHireNewWorkerContract hireNewWorkerContract = HcmHireNewWorkerContract::construct();
hireNewWorkerContract.parmDirPersonName(personName);
hireNewWorkerContract.parmPersonnelNumber(empid);
hireNewWorkerContract.parmEmploymentValidFrom(startDate); //Assign employment start date
hireNewWorkerContract.parmEmploymentValidTo(endDate); //Assign employment end date
hireNewWorkerContract.parmLegalEntityRecId(legalEntityRecId); //Assign legal entity provided in form
hireNewWorkerContract.parmEmploymentType(HcmEmploymentType::Employee);
 
workerRecId = HcmWorkerTransition::newHireHcmWorkerV2(hireNewWorkerContract);
 
From what I've been able to see, the error seems to be coming from HcmWorker.aosValidateInsert() when it calls super(). I'm not able to get beyond where the method is called so I haven't been able to locate the source or understand what is missing as far as a connectionstring. 
Categories:
  • CU29041349-0 Profile Picture
    466 on at
    Error "Worker staging failed" while creating HcmWorker through X++
    Hi Andre,
     
    I removed the position assignment code as I was testing. To me, it didn't appear to be the issue. 
     
    I used the code from PersonnelManagemementWorkspaceDemoScript::hire() but I continue to get the error message. Maybe it's something in my development environment which is misconfigured...no idea. 
  • André Arnaud de Calavon Profile Picture
    296,033 Super User 2025 Season 1 on at
    Error "Worker staging failed" while creating HcmWorker through X++
    Hi,
     
    Not entirely sure, but maybe there are some mandatory parm methods. In another script, I see parameters filled for the position assignment which are not in your coding. (PersonnelManagemementWorkspaceDemoScript::hire)
     
    hireNewWorkerContract.parmPositionRecId(_position.RecId);
    hireNewWorkerContract.parmPositionAssignmentStartDate(_startDate);
    hireNewWorkerContract.parmPositionAssignmentEndDate(endDate);
    
     
     
     

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565

#2
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 402 Super User 2025 Season 1

Product updates

Dynamics 365 release plans