Skip to Content
Author's profile photo Jerry Wang

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;

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Great article but is there any changes in code because I get an error that "OrganisationalUnitAssignment" doesn't exist:

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Did u import import ABSL; import AP.PC.IdentityManagement.Global; import AP.FO.BusinessPartner.Global; ?

      Author's profile photo Former Member
      Former Member

      <a href="">May 2018 Calendar Printable</a>


      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      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?




      Author's profile photo Ag Grandhi
      Ag Grandhi

      Hello Dhruvin,

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



      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      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.




      Author's profile photo Nathanael Mangold
      Nathanael Mangold

      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

      Author's profile photo Jing Yang
      Jing Yang

      It's very useful snippet.

      Author's profile photo Tiago Almeida
      Tiago Almeida

      Thanks Jerry! It’s posts like this that give any hope of being able to deal with this .. system.


      Thanks again

      Author's profile photo Sangeeta Roy
      Sangeeta Roy

      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()

      Author's profile photo ekrem seven
      ekrem seven

      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.


      Author's profile photo Ag Grandhi
      Ag Grandhi

      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.