Showing results for 
Search instead for 
Did you mean: 

Retrieve Company Details based on employeeID

Former Member
0 Kudos

Hi ByD'ers

Can some help me find the correct way of determining an employees company based on the input of EmployeeID?

I have a ByD form that has a public OVS to look up employee ID, and with a script I can use this to determine employees full name.

What I am having difficulty with is then determining the same employees Org Centre assignment and Company assignment.

I can see these attributes are available, but seem unable to get any data from them.

I am using this so that the form I have designed can be used to create a purchase order that will dynamically add user Buying Party data based on the employee selected, not necessarily the currently logged in user (so cant use context as a the starting point)

Help with a code snippet perhaps would find me eternally grateful.

John Meadows

+44 7449 944666

Accepted Solutions (1)

Accepted Solutions (1)

Active Participant
0 Kudos

Hi John.

There you go, just made a simple query without parameters, is just matter of setting the EmployeeID to it

var CompanyID = Employee.QueryByIdentification.Execute().GetFirst().Position.OrganisationalCentreAssignment.Company.GetFirst().ID;

Answers (2)

Answers (2)

Former Member
0 Kudos


Can you please share the script to fetch the Employee name ? I have also used the EmployeeID OVS, but when I query the Employee BO on the returned ID the result set is empty. Following is the script I have used:

Here "EmployeeResponsible" is an extension element with type ID

import AP.FO.BusinessPartner.Global;

var ERquery = Employee.QueryByIdentification;

var ERresultData = ERquery.ExecuteDataOnly();

var ERselectionParams = ERquery.CreateSelectionParams();

ERselectionParams.Add(ERquery.InternalID, "I", "EQ", this.EmployeeResponsible.RemoveLeadingZeros());

ERresultData = ERquery.ExecuteDataOnly(ERselectionParams);

var ER = Employee.Retrieve(ERresultData.GetFirst().UUID);

this.EmployeeResponsibleDescription = ER.CurrentCommon.BusinessPartnerFormattedName;



Former Member
0 Kudos


There is one problem with the above code. The association OrganisationalCenterAssignment is actually 0:n enabled and you need to filter out the correct entry related to the Company.

just use the following where clause

var CompanyID = Employee.QueryByIdentification.Execute().GetFirst().Position.OrganisationalCentreAssignment.Where(n=>n.BusinessCharacterCode == "1").Company.GetFirst().ID;