private HcmPersonnelNumberId nextPersonnelNumberId()
{
HcmPersonnelNumberId hcmPersonnelNumberId;
NumberSequenceReference numberSeqReferencePersonnelNum;
NumberSequenceTable numberSeqTablePersonnelNum;
NumberSeq numberSeqPersonnelNum;
// Number Sequence
numberSeqReferencePersonnelNum = NumberSeqReference::findReference(extendedTypeNum(HcmPersonnelNumberId));
numberSeqTablePersonnelNum = NumberSequenceTable::find(numberSeqReferencePersonnelNum.NumberSequenceId);
if (numberSeqTablePersonnelNum)
{
// generate worker personnel number if number sequence code is created.
numberSeqPersonnelNum = NumberSeq::newGetNumFromId(numberSeqTablePersonnelNum.RecId, true, true);
if(numberSeqPersonnelNum)
{
hcmPersonnelNumberId = numberSeqPersonnelNum.num();
}
}
return hcmPersonnelNumberId;
}
private void createHCMWorker()
{
AxDirPerson person;
AxDirPersonName personName;
HcmWorker worker;
HcmPersonnelNumberId hcmPersonnelNumberId;
hcmPersonnelNumberId = this.nextPersonnelNumberId();
if (!hcmPersonnelNumberId)
return;
// Create a person
person = AxDirPerson::construct();
person.parmName("Santa Claus");
person.save();
personName = AxDirPersonName::construct();
personName.parmPerson(person.dirPerson().RecId);
personName.parmFirstName(person.dirPerson().Name);
personName.parmValidTo(DateTimeUtil::maxValue());
personName.save();
// Create the worker
HcmWorkerTransition::newCreateHcmWorker(personName.dirPersonName(), hcmPersonnelNumberId);
}
No comments:
Post a Comment