Skip to main content

Notifications

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 442
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
    442 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
    294,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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,033 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,854 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans