cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Account name by querying of Business Partner with contactID

Former Member
0 Kudos

Hi,

By querying with ContactID I get all address information from BussinessPartner. But Account Name can't be extracted from object model.

Is It possible to get Account Name from BusinessPartner by querying with ContactID?

Pls help me.

Thanks and Regards,

Swati

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee
0 Kudos

Hi Swati,

You can refer following code:

import ABSL;
import AP.FO.BusinessPartner.Global;
var q = BusinessPartner.QueryByIdentification;
var p = q.CreateSelectionParams();
p.Add( q.InternalID, "I", "EQ", "1042044"); // Contact ID for whcih account name to be identified
var r = q.Execute(p);
if (r.GetFirst().IsSet())
{
var n = r.GetFirst();
	if (n.BusinessPartnerRelationship.GetFirst().IsSet())
	{
		var t = n.BusinessPartnerRelationship.GetFirst();
		if ( t.IsSet())
		{
			var b = t.FirstBusinessPartner;
			if ( b.IsSet())
			{
				var name = b.CurrentCommon.Organisation.Name.FirstLineName;
				var sort = b.CurrentCommon.SortingFormattedName;
			}
		}
	}
}

Thanks

Saurabh

Former Member
0 Kudos

Hi Saurabh,

Thank you very much for helping me with a prompt and nice code.

Furthermore, pls help me to get the values of Contact Permission, Title and Job Title by querying with ContactID.

Thanks again

Swati

Answers (0)