Skip to Content

How to get current logged on business user’s employee information and assigned organization unit via ABSL

Suppose I have business user WANGJERRY37 which could be reviewed in Work center Administrator, and once clicking Name column,
I could find corresponding employee ID 37 and its department name:
This India PMLS could be found in Work center view Administrator->General Settings->Company->Org Structures:
Suppose I want to retrieve the Department Name of the current logged on business user’s assigned Organization unit for example PMLS below:
The general idea is:
  1. get current log on business user’s uuid via Context.GetCurrentIdentityUUID()
  2. get the identification instance of the found business user by query
  3. get the corresponding employee instance of current business user
  4. get assigned organization unit of found employee got from step 3
  5. get the department name of found organization unit from association NameAndAddress
  6. create a transient field in a custom BO and write the above logic into AfterLoading event. The script file for this AfterLoading is marked as NOT mass-enabled.
Now once I open the TI page of my custom BO, the transient field is filled by the script accordingly.
The complete ABSL source code could be found below:
import ABSL;
import AP.PC.IdentityManagement.Global;
import AP.FO.BusinessPartner.Global;

var queryByIdentityUUID = Identity.QueryByElements;
var queryByIdentityUUIDParameter = queryByIdentityUUID.CreateSelectionParams();
var queryByEmployeeBPUUID = Employee.QueryByIdentification;
var queryByEmployeeBPUUIDParameter = queryByEmployeeBPUUID.CreateSelectionParams();

if ( this.DepartmentName.IsInitial()){

	var id = Context.GetCurrentIdentityUUID().content;
	queryByIdentityUUIDParameter.Add( queryByIdentityUUID.UUID.content, "I", "EQ", id.ToString() );
	var result = queryByIdentityUUID.Execute(queryByIdentityUUIDParameter);
	var first = result.GetFirst(); // points to identity instance
	var person = first.Person;
	var bpUUId = person.UUID.content;
	queryByEmployeeBPUUIDParameter.Add( queryByEmployeeBPUUID.UUID.content, "I", "EQ", bpUUId.ToString());
	var employeeQueryResult = queryByEmployeeBPUUID.Execute(queryByEmployeeBPUUIDParameter);
	var EmployeeQueryResultCurrent = employeeQueryResult.GetFirst();
	var assignedOrg = EmployeeQueryResultCurrent.OrganisationalUnitAssignment.GetFirst();
	var org = assignedOrg.ToRoot;
	  // readOnly in AfterLoading event
	   this.DepartmentName  = org.NameAndAddress.AddressSnapshot.NameSuitableForLogonLanguage.GetFirst().Name.SecondLineName;
You must be Logged on to comment or reply to a post.
  • /
  • Hello Jerry,


    Can I get Employee information like assigned user id , territories where he is assigned , from a web service?

    I didnt find any standard webservice which gives me employee id if I pass his user name.

    Can you please help me in this?




    • Hello Dhruvin,

      Could you provide the Web Service details incase if you are able to find one? We also have similar requirement.



      • Hi Ag,

        Unfortunately i dont remember it now fully 😛

        However as far as i know wedid create a fullly customBO for it and made an Odata Services for it.

        I know not a good solution but unfortunately that was the fastest solution.




  • Hello Jerry,


    Is it also possible to do a similar thing for ByDesign? For e.g. use a button to get to a custom BO with a hand over of the ID of an Opportunity?


    Best Regards,

    Nathanael Mangold

  • Nice post Jerry! It is very helpful. Considering that an employee can be terminated/rehired, he can have multiple employee records with the same UUID and considering that an employee can be transferred to different org unit, he can can have multiple Org Assignments. So I think it would be best to consider the current dates in the above queries to get the current employee record and current Org assignment instead of getFirst()

  • Dear Jerry,


    Great Post, thank you for sharing. One thing is that avoiding Query executing; Retrieve method is faster than any Query so if you need to reach the object with UUID you can use Retrieve. For this case you can get the personid by;

    var bpUUId = Identity.Retrieve(Context.GetCurrentIdentityUUID()).Person.UUID.content;


    Thank you.


  • Dear Jerry,

    Very useful snippet. I was wondering, is it possible to enhance C4C top right section and include attributes from User Profile? Appreciate your time.