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

Announcements

No record found.

News and Announcements icon
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 610
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
    303,653 Super User 2026 Season 1 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
    610 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 613

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 455 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 292 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans