Solved

Unable to create custom lookup field to business account

  • 20 March 2023
  • 8 replies
  • 110 views

I’m new to development and customization with Acumatica.  I’m attempting to add a new field to Business Account.  It’s going to be a lookup to the Employee records.I discovered that employee records are stored in the Business Account table.  So it’s a lookup back to BAccount for the employee record. 
Requirements are to setup a secondary owner for Business Accounts. 
 

This is the only information I’ve added to the attribute field: 
[PXDBInt]
[PXSelector(
    typeof(Search<BAccount.BAccountID,
        Where<BAccount.Type,Equal<EP>>>),
    typeof(BAccount.AcctCD),
    typeof(BAccount.LegalName),
    SubstituteKey = typeof(BAccount.AcctCD),
    DescriptionField = typeof(BAccount.LegalName)]
[PXUIField(DisplayName="SecondaryOwner2")]
Everytime I go to publish the information I get an error.  

\App_RuntimeCode\PX_Objects_CR_BAccount_extensions.cs(29): error CS0426: The type name 'AcctCD' does not exist in the type 'BAccount'Any assistance would be greatly appreciated. 
icon

Best answer by aaghaei 21 March 2023, 01:15

View original

8 replies

Badge +16

Have you considered handling the above new field with Attributes? Selector Attributes provide ability to look up into the Employees list with no code.

I have, but for a better user experience, they’re asking for the field to be on the same screen.  Unless there’s a way to move attributes to the Summary section of the screen.  

Userlevel 7
Badge +8

if you want only employee list there is a built-in selector that can be called as [Employee]

Userlevel 7
Badge +6

@prachayang you may be able to create a “user defined field” as an alternative.  this would be similar to an attribute though 

@aaghaei do you have an idea of how I might add that.  I did a bit a research and it seems the Employee selector is called EPEmployee.  
I replaced the selector code with this: 
[PXSelector(
    typeof(Search<EPEmployee.BAccountID>),
    typeof(EPEmployee.acctCD),
    typeof(EPEmployee.acctName),
    SubstituteKey = typeof(EPEmployee.acctCD),
    DescriptionField = typeof(EPEmployee.acctName)]

but i’m getting a different kind of error

\App_RuntimeCode\PX_Objects_CR_BAccount_extensions.cs(37): error CS0426: The type name 'BAccountID' does not exist in the type 'EPEmployee'
Userlevel 7
Badge +8

@prachayang

Assuming the field you have is an INT field, use the below properties instead of ALL of the existing ones. It has both Field Type and selector inside and filters on all Active Employees.

[PX.Objects.AP.VendorActive(typeof(Search<PX.Objects.AP.Vendor.bAccountID, Where<PX.Objects.AP.Vendor.type, Equal<PX.Objects.CR.BAccountType.employeeType>>>),
DescriptionField = typeof(PX.Objects.AP.Vendor.acctName),
DisplayName = "Employee",
Visibility = PXUIVisibility.SelectorVisible, Visible = true,
Required = false, Enabled = true, CacheGlobal = true, Filterable = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]

 

Userlevel 7
Badge +8

Oh, also I fully qualified the objects “PX.Obj...” because I was unsure where you will be putting these definitions and how you are going to declare the directives.

Userlevel 7
Badge +17

@prachayang  Please share your customization package, so that we can review that error while publishing and help you to resolve it.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved