on 11-25-2015 9:09 PM
Hi,
I am working on SAP Cloud for Travel and Expense and I want to get the email address of an employee.
How can i access and get it.
Thanks in advance.
Hi Taha,
If you are looking for the current logged in employee Email address follow the below code
import AP.PC.IdentityManagement.Global;
import AP.FO.BusinessPartner.Global;
var current_emp_uuid = Context.GetCurrentIdentityUUID();
var current_employee_name;
if(!current_emp_uuid.content.IsInitial())
{
var bupa_uuid = Identity.Retrieve(current_emp_uuid).BusinessPartnerUUID;
if(!bupa_uuid.content.IsInitial())
{
var employee = Employee.Retrieve(bupa_uuid);
if(employee.IsSet())
{
if (employee.CurrentDefaultEmployeeWorkplaceAddressInformation.IsSet())
{
var employeeWorkPlaceAddressInfo = employee.CurrentDefaultEmployeeWorkplaceAddressInformation;
if (employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.IsSet())
{
employeeMailID = employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.DefaultEMail.URI.content;
}
}
}
}
}
********
If it is the the way round, like if you want to find any specific employee email id then following code will be useful
var employee = Employee.Identification.Retrieve(notification.Source);
if (employee.IsSet())
{
if (employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation.IsSet())
{
var employeeWorkPlaceAddressInfo = employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation;
if (employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.IsSet())
{
employeeMailID = employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.DefaultEMail.URI.content;
}
}
}
Please try the above according to your need
Regards
Hanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Taha,
Email content, what you mean by this. Please if you don't mind lets not continue this conversation over in the same thread.
If I am not in a position to give some useful answers others might do for you and solve your issue. This is already marked as answered and less chances of looking into it for new request...
Thanks for understanding...
Regards
Hanu
Hello Taha,
Did you take a look at blogs like "New E-Mail Functionality" or "How to send HTML E-Mail"?
Bye,
Horst
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.