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
  • 28 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


	   }
   }

 

View original
Did this topic help you find an answer to your question?

Naveen Boga
Captain II
Forum|alt.badge.img+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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings