cancel
Showing results for 
Search instead for 
Did you mean: 

C4C/SDK - How get the contact person information

Former Member
0 Kudos

Hello everybody,

From a custom BO, I created a field with type ContactPersonInternalID and I set the DisplayType as ObjectValueSelector with the Public OVS /BYD_COD/SalesOnDemand/Contact/UI/COD_Contact_SOVS.OVS.uicomponent

It works fine, but I get only the ContactPersonID while I would like also display the name.

I had a similar need on Employee and it works fine with this code :

var employee_PlantQM;

employee_PlantQM = Employee.Identification.Retrieve(this.Plant_QM_or_CS_Mgr_code);

if(employee_PlantQM.IsSet()){

  this.ToEmployee = employee_PlantQM.ToRoot;

  this.Plant_QM_or_CS_Mgr_Employee_name = this.ToEmployee.CurrentCommon.Person.Name.GivenName + " " + this.ToEmployee.CurrentCommon.Person.Name.FamilyName;

}

else

  this.Plant_QM_or_CS_Mgr_Employee_name.Clear();

Same for the customer with this code :

var query = Customer.QueryByIdentification;
var selectionParams = query.CreateSelectionParams();
var resultData;
selectionParams.Add(query.InternalID, "I", "EQ", this.Customer_code);
// Result
resultData = query.Execute(selectionParams);
this.Customer_BusinessPartner_name.Clear();
foreach(var account in resultData)
{
this.Customer_BusinessPartner_name = account.CurrentCommon.BusinessPartnerFormattedName;
}

So, do you know if it exists a similar way to get the ContactPerson name ? which object should I use ?

Thank you

Best regards

Olivier

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Does Someone is able to provide me the correct way to get the contact person information, like the country ?

Thank you

Regards

Olivier

former_member240914
Participant
0 Kudos

Hello Oliver,

Contacts is also a BusinessPartner. You can retrieve the name as shown below

var Contact = BusinessPartner.Retrieve(ContactID); //ContactID is of type BusinessPartnerInternalID

var ContacCurrCommon = Contact.CurrentCommon;

var FormatName = ContacCurrCommon.BusinessPartnerFormattedName;

var FirstName = ContacCurrCommon.Person.Name.GivenName;

...

If you need more information on the BO and Specific fields, you can open the respective UI (ex Contacts TI)  from UI designer and check the UI binding to Data model and BO model.

Thanks Pramodh

Former Member
0 Kudos

Thank you Pramodh ! I'm going to try it