Solved

Adding Project ID selector to Item Classes screen

  • 28 June 2021
  • 3 replies
  • 303 views

Userlevel 3
Badge

Hi 

I am trying to add the project ID selector to the Item Classes screen. I have added a custom field and created a control and have tried to use the ProjectBaseAttribute to allow me to select a project and save it against the class. 

[ProjectBaseAttribute(DisplayName="Project ID")]

When I validate I receive the following error:

\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(23): error CS0246: The type or namespace name 'ProjectBaseAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(23): error CS0246: The type or namespace name 'ProjectBaseAttribute' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(23): error CS0246: The type or namespace name 'DisplayName' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(23): error CS0246: The type or namespace name 'ProjectBaseAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?)
Compiler time, in seconds: 41.546804
Validation failed.

Should I use a different base attribute or do I need to do something else to reference it? 

 

The intent is to be able to associate an Item Class to a project ID for reporting purposes.

 

Thanks

 

Matt

 

icon

Best answer by Naveen Boga 28 June 2021, 19:31

View original

3 replies

Userlevel 7
Badge +17

Hi Matt, 
I think you are doing something wrong here. I just worked on this customization. Please find the attached customization package, you can publish this package and verify

 

 

Please find the screenshot for reference.

 

Userlevel 3
Badge

Hi @Naveen B 

 

Thanks for coming back, It is different but not better. :) 

\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(37): error CS0102: The type 'INItemClassExt' already contains a definition for 'usrProjectID'
\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(36): error CS0102: The type 'INItemClassExt' already contains a definition for 'UsrProjectID'
\App_RuntimeCode\PX_Objects_IN_INItemClass_extensions.cs(37): error CS0102: The type 'INItemClassExt' already contains a definition for 'usrProjectID'

It could be user error, I added the below to the IN.INitemClass UserProjectID field as per the screenshot below.

 

using PX.Objects.PM;

#region ProjectID
public abstract class usrProjectID : PX.Data.BQL.BqlInt.Field<usrProjectID> { }
[ProjectDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[ProjectBase]
public virtual int? UsrProjectID
{
get;
set;
}
#endregion

 

 

Thanks

 

Matt

Userlevel 7
Badge +17

Hi @mbrown Looks like namespace not added.  Can you please add below namespace and verify?

using PX.Objects.PM;

 

#region ProjectID
        public abstract class usrProjectID : PX.Data.BQL.BqlInt.Field<usrProjectID> { }
        [ProjectDefault(PersistingCheck = PXPersistingCheck.Nothing)]      
        [ProjectBase]
        public virtual int?  UsrProjectID
        {
            get;
            set;
        }
        #endregion

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