To change Company of Employee in Axapta by code you can get hint by below code. Its tedius task to update you need to do it very carefully and understand then code then apply in your customization.
ttsBegin;
hcmWorker=hcmWorker::findByPersonnelNumber(Personalumberid);
select companyinfohsd where companyinfohsd.dataAreaId=="dat";
select companyinforss where companyinforss.dataAreaId=="ceu";
select forupdate hcmEmployment where hcmEmployment.Worker==hcmWorker.RecId && hcmEmployment.LegalEntity==companyinfohsd.RecId;
hcmEmployment.LegalEntity=companyinforss.RecId;
hcmEmployment.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
hcmEmployment.doUpdate();
ttsCommit;
Comments