Skip to main content
Answer

i need to fetch Attention, Email, Phone1 and Phone2 from Contact (Companies) in any graph any time

  • July 4, 2024
  • 2 replies
  • 57 views

Forum|alt.badge.img

 

Best answer by Naveen Boga

@hyadav08  I have done this customization recently for one my clients and below is the sample code for your reference.

 

   PX.Objects.CR.BAccount objBAccount = PXSelectJoin<PX.Objects.CR.BAccount, 
InnerJoin<Organization, On<Organization.bAccountID, Equal<PX.Objects.CR.BAccount.bAccountID>>,
InnerJoin<PX.Objects.GL.Branch,On<PX.Objects.GL.Branch.organizationID,Equal<Organization.organizationID>>>>,
Where<PX.Objects.GL.Branch.branchID,Equal<Required<PX.Objects.GL.Branch.branchID>>>>.
Select(customerMaint, customerMaint.Accessinfo?.BranchID);

if (objBAccount != null)
{
OrganizationMaint OMaint = PXGraph.CreateInstance<OrganizationMaint>();

OrganizationBAccount OBAccount = PXSelect<OrganizationBAccount, Where<OrganizationBAccount.bAccountID,
Equal<Required<OrganizationBAccount.bAccountID>>>>.Select(OMaint, objBAccount?.BAccountID);
if (OBAccount != null)
{
OMaint.BAccount.Current = OBAccount;

PX.Objects.CR.Address MainAddress = OMaint.GetExtension<OrganizationMaint.DefContactAddressExt>().DefAddress.Select()[0];
PX.Objects.CR.Contact MainContact = OMaint.GetExtension<OrganizationMaint.DefContactAddressExt>().DefContact.Select()[0];

// Get The Address Details from MainAddress object
//Get the Contact Details from MainContact object


}
}

 

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • July 4, 2024

@hyadav08  I have done this customization recently for one my clients and below is the sample code for your reference.

 

   PX.Objects.CR.BAccount objBAccount = PXSelectJoin<PX.Objects.CR.BAccount, 
InnerJoin<Organization, On<Organization.bAccountID, Equal<PX.Objects.CR.BAccount.bAccountID>>,
InnerJoin<PX.Objects.GL.Branch,On<PX.Objects.GL.Branch.organizationID,Equal<Organization.organizationID>>>>,
Where<PX.Objects.GL.Branch.branchID,Equal<Required<PX.Objects.GL.Branch.branchID>>>>.
Select(customerMaint, customerMaint.Accessinfo?.BranchID);

if (objBAccount != null)
{
OrganizationMaint OMaint = PXGraph.CreateInstance<OrganizationMaint>();

OrganizationBAccount OBAccount = PXSelect<OrganizationBAccount, Where<OrganizationBAccount.bAccountID,
Equal<Required<OrganizationBAccount.bAccountID>>>>.Select(OMaint, objBAccount?.BAccountID);
if (OBAccount != null)
{
OMaint.BAccount.Current = OBAccount;

PX.Objects.CR.Address MainAddress = OMaint.GetExtension<OrganizationMaint.DefContactAddressExt>().DefAddress.Select()[0];
PX.Objects.CR.Contact MainContact = OMaint.GetExtension<OrganizationMaint.DefContactAddressExt>().DefContact.Select()[0];

// Get The Address Details from MainAddress object
//Get the Contact Details from MainContact object


}
}

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • June 19, 2025

Hi ​@Naveen Boga,

Than’s for Reply.

With this my purpose was accomplished.