web
You’re offline. This is a read only version of the page.
close
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++

(2) ShareShare
ReportReport
Posted on by 558
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:
I have the same question (0)
  • CU29041349-0 Profile Picture
    558 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
    298,009 Super User 2025 Season 2 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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 886 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 870 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 697

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans