Skip to Content
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;
	}
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply