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 :
Finance | Project Operations, Human Resources, ...
Unanswered

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

(2) ShareShare
ReportReport
Posted on by 606
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)
  • André Arnaud de Calavon Profile Picture
    301,194 Super User 2025 Season 2 on at
    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);
    
     
     
     
  • CU29041349-0 Profile Picture
    606 on at
    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. 

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans