Skip to main content
Solved

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

  • 4 July 2024
  • 1 reply
  • 20 views

 

1 reply

Userlevel 7
Badge +19

@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


}
}

 

Reply