Below code snipet is one of the way to retrieve employee/worker's primary email address.
private LogisticsElectronicAddressLocator getInstructorEmail(HcmWorkerRecId _workerRecId)
{
LogisticsElectronicAddress logisticsElectronicAddress;
HcmWorker hcmWorker;
DirPerson dirPerson;
DirPartyTable dirPartyTable;
select hcmWorker
where hcmWorker.RecId == _workerRecId
join dirPerson
where dirPerson.RecId == hcmWorker.Person
join dirPartyTable
where dirPartyTable.RecId == dirPerson.RecId
join logisticsElectronicAddress
where dirPartyTable.PrimaryContactEmail == logisticsElectronicAddress.RecId;
return logisticsElectronicAddress.Locator;
}
private LogisticsElectronicAddressLocator getInstructorEmail(HcmWorkerRecId _workerRecId)
{
LogisticsElectronicAddress logisticsElectronicAddress;
HcmWorker hcmWorker;
DirPerson dirPerson;
DirPartyTable dirPartyTable;
select hcmWorker
where hcmWorker.RecId == _workerRecId
join dirPerson
where dirPerson.RecId == hcmWorker.Person
join dirPartyTable
where dirPartyTable.RecId == dirPerson.RecId
join logisticsElectronicAddress
where dirPartyTable.PrimaryContactEmail == logisticsElectronicAddress.RecId;
return logisticsElectronicAddress.Locator;
}
Never mind, I am not sure about benefit of rewriting code if HcmWorker.email() can be used
ReplyDeleteThat's a good point, I did not check HcmWorker table. Thanks for your input Sohaib
DeleteIts very helpful if we need email/phone number based on the purpose e.g. Invoice, Delivery etc.
ReplyDelete