Skip to main content
Answer

Only customers are displayed on Project Screen Business Account Selector

  • July 12, 2023
  • 5 replies
  • 126 views

Forum|alt.badge.img+9

Hi Experts,

I am working on a couple of things to include all Business Accounts in the selection on Projects (PM301000) screen. As of now only customers are displayed under selector of Business Accounts.

I have tried the standard code as below.

[PXDBInt]
[PXDimensionSelector("BIZACCT", typeof(BAccount.bAccountID), substituteKey: typeof(BAccount.acctCD), DescriptionField = typeof(BAccount.acctName))]
[PXUIField(DisplayName = "Business Account", Visibility = PXUIVisibility.SelectorVisible)]

I have tried below workaround to achieve the same but unable to get the desired outcome on the Projects screen.

 #region Usrbaccount
[PXDBInt]
[PXUIField(DisplayName = "Business Account")]
[PXSelector(typeof(Search<BAccount.acctCD,
Where<BAccount.type, Equal<ContractExt.HardCodeValues.VE>,
Or<BAccount.type, Equal<ContractExt.HardCodeValues.CP>,
Or<BAccount.type, Equal<ContractExt.HardCodeValues.CU>,
Or<BAccount.type, Equal<ContractExt.HardCodeValues.EP>,
Or<BAccount.type, Equal<ContractExt.HardCodeValues.OR>,
Or<BAccount.type, Equal<ContractExt.HardCodeValues.PR>>>>>>>>),
typeof(BAccount.acctName),
DescriptionField = typeof(BAccount.acctName))]
public virtual int? Usrbaccount { get; set; }
public abstract class usrbaccount : PX.Data.BQL.BqlInt.Field<usrbaccount> { }
#endregion

public static class HardCodeValues
{
public class VE : BqlType<IBqlString, string>.Constant<VE>
{
public VE() : base(value: "VE")
{
}
}

public class CP : BqlType<IBqlString, string>.Constant<CP>
{
public CP() : base(value: "CP")
{
}
}

public class CU : BqlType<IBqlString, string>.Constant<CU>
{
public CU() : base(value: "CU")
{
}
}

public class EP : BqlType<IBqlString, string>.Constant<EP>
{
public EP() : base(value: "EP")
{
}
}

public class OR : BqlType<IBqlString, string>.Constant<OR>
{
public OR() : base(value: "OR")
{
}
}

public class PR : BqlType<IBqlString, string>.Constant<PR>
{
public PR() : base(value: "PR")
{
}
}
}

However, when I attempted to run the both logic on the Business Accounts screen, it worked as expected. On the other hand, when I tried it on the Employee Time Cards screen, it only displayed employees in the selector.

I believe this behavior is occurring due to the restrictions imposed on the screens. Am I correct or anyone else have an idea to achieve the same?

Thanks!

Best answer by Zoltan Febert

Hi @sweta68, it will work if you use BAccountR in your selector. I tried it on 22.207 and 22.212.

        [PXDBInt]
[PXSelector(typeof(SelectFrom<BAccountR>.SearchFor<BAccountR.bAccountID>),
typeof(BAccountR.bAccountID), typeof(BAccountR.type), SubstituteKey = typeof(BAccountR.acctCD), DescriptionField = typeof(BAccountR.acctName))]
[PXUIField(DisplayName = "Customer ID", Visibility = PXUIVisibility.SelectorVisible)]

 

5 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3

Hi @sweta68,

 

Can you please clarify what the problem exactly is?

 

I added your first approach to cache attached in a ProjectEntry extension, and it replaced the selector of CustomerID, I could select all business account.

    public class TestProjectEntry : PXGraphExtension<ProjectEntry>
{
[PXDBInt]
[PXDimensionSelector("BIZACCT", typeof(BAccount.bAccountID), substituteKey: typeof(BAccount.acctCD), DescriptionField = typeof(BAccount.acctName))]
[PXUIField(DisplayName = "Customer ID", Visibility = PXUIVisibility.SelectorVisible)]
protected virtual void _(Events.CacheAttached<PMProject.customerID> e) {}
}

After I tried to extend PMProject DAC. I added an unbound field to the DAC, I added the new field to the screen, and it worked as expected.

    public class TestPMProject : PXCacheExtension<PMProject>
{
#region Usrbaccount
[PXInt]
[PXDimensionSelector("BIZACCT", typeof(BAccount.bAccountID), substituteKey: typeof(BAccount.acctCD), DescriptionField = typeof(BAccount.acctName))]
[PXUIField(DisplayName = "Business Account", Visibility = PXUIVisibility.SelectorVisible)]
public virtual int? Usrbaccount { get; set; }
public abstract class usrbaccount : PX.Data.BQL.BqlInt.Field<usrbaccount> { }
#endregion
}

 


Forum|alt.badge.img+9
  • Author
  • Semi-Pro III
  • July 13, 2023

Hi @zfebert56 ,

Thank you for your reply. Yes, I have implemented the logic as you suggested previously, but it is not functioning as intended. I have attached a video to provide a clearer understanding of the issue.

I have also observed a similar behavior on the Projects, Employee Time Cards, and Business Accounts screens. Specifically:

  • On the Projects screen, only customers are displayed in the selector.
  • On the Employee Time Cards screen, only employees are displayed.
  • On the Business Accounts screen, all types of business accounts (i.e., customers, vendors, employees) are displayed.

I would like to inquire if there are any restrictions on these screens that limit the display of business accounts based on their types (customers, vendors, etc.).


Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3

@sweta68 On my instance I can see vendors, customers, employees, etc in the selector on the project screen. Please share a small customization package, and I will try it on my system.


Forum|alt.badge.img+9
  • Author
  • Semi-Pro III
  • July 14, 2023

Hi @zfebert56 , Thanks for assistance.

I have attached a customization package. I am working on Acumatica version 22.210.0020.


Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • Answer
  • July 15, 2023

Hi @sweta68, it will work if you use BAccountR in your selector. I tried it on 22.207 and 22.212.

        [PXDBInt]
[PXSelector(typeof(SelectFrom<BAccountR>.SearchFor<BAccountR.bAccountID>),
typeof(BAccountR.bAccountID), typeof(BAccountR.type), SubstituteKey = typeof(BAccountR.acctCD), DescriptionField = typeof(BAccountR.acctName))]
[PXUIField(DisplayName = "Customer ID", Visibility = PXUIVisibility.SelectorVisible)]