AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • In-Person Gatherings
    • Power BI Workshop
    • Podcast
    • Rolodex
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Everything Else
How to add an attri...
 
Notifications
Clear all

Questions How to add an attribute column to SO Line Grid.

 
Everything Else
Last Post by Robert Sternberg 4 years ago
1 Posts
1 Users
1 Reactions
1,161 Views
RSS
Robert Sternberg
Posts: 7
 Robert Sternberg
Topic starter
August 18, 2021 4:25 pm
(@robertsternberg)
Active Member
Joined: 5 years ago

I am attempting to add the SQFTINBOX stock item attribute to the Sales Order Grid.  

 

I have declared a class PXAddAttributeColumns as below: 

  public class PXAddAtttributeColumns : CRAttributesFieldAttribute
{
    string[] _names;
    bool _IsForSelector;

    public PXAddAtttributeColumns(string[] names, Type entityType, Type entityIDField, Type classIDField, bool IsForSelector = true)
        : base(entityType, entityIDField, classIDField)
    {
        _names = names;
        _IsForSelector = IsForSelector;
    }

    public override void CacheAttached(PXCache sender)
    {
        this._IsActive = true;
        base.CacheAttached(sender);
    }

    protected override void AttributeFieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, PXFieldState state, string attributeName, int idx)
    {
        if (_names.Any(attributeName.Equals))
        {
            //Out-of-box DisplayName is prefixed with "$Attributes$-" - if you need to take that off.
            state.DisplayName = (!String.IsNullOrEmpty(state.DisplayName)) ? (state.DisplayName.Replace("$Attributes$-", "")) : attributeName;
            state.Visible = true;
            //Requires AutoGenerateColumns="AppendDynamic" for PXGrid Control for dynamic Attribute columns creation
            state.Visibility = (_IsForSelector) ? PXUIVisibility.SelectorVisible : PXUIVisibility.Dynamic;
        }
        base.AttributeFieldSelecting(sender, e, state, attributeName, idx);
    }

    public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
    {
        base.CommandPreparing(sender, e);

        if (e.BqlTable == null && aggregateAttributes && sender.GetItemType().IsDefined(typeof(PXProjectionAttribute), true))
        {
            e.BqlTable = _BqlTable;
        }
    }
}

Add Extended SO Line as below:

      public class SOLineExtension : PXCacheExtension<SOLine>
{
    public abstract class itemAttributes : IBqlField { }

    [PXAddAtttributeColumns(new[] {"SQFTINBOX"},
            typeof(CSAnswerType.inventoryAnswerType),
            typeof(SOLine.inventoryID),
            typeof(InventoryItem.itemClassID), false)]
    public virtual string[] ItemAttributes { get; set; }
}

I received an error message during validation as shown below: 

Validation started.
Copying the website c:\deployment\sites\#####\Customization\#####\siterootValidation\siterootWebsite
Patching the file c:\deployment\sites\#####\Customization\#####\siterootValidation\siterootWebsite\App_RuntimeCode\PXAddAttributeColumns.cs
Patching the file c:\deployment\sites\#####\Customization\#####\siterootValidation\siterootWebsite\App_RuntimeCode\SOLine.cs
Done
Validating Binary Files
Validating Sql Scripts
Validating the website c:\deployment\sites\#####\Customization\#####\siterootValidation\siterootWebsite
IIS APPPOOL\#####
Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\PXAddAttributeColumns.cs(6): error CS0246: The type or namespace name 'CRAttributesFieldAttribute' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\PXAddAttributeColumns.cs(18): error CS0115: 'PXAddAtttributeColumns.CacheAttached(PXCache)': no suitable method found to override
\App_RuntimeCode\PXAddAttributeColumns.cs(24): error CS0115: 'PXAddAtttributeColumns.AttributeFieldSelecting(PXCache, PXFieldSelectingEventArgs, PXFieldState, string, int)': no suitable method found to override
\App_RuntimeCode\PXAddAttributeColumns.cs(37): error CS0115: 'PXAddAtttributeColumns.CommandPreparing(PXCache, PXCommandPreparingEventArgs)': no suitable method found to override
\App_RuntimeCode\SOLine.cs(30): error CS0246: The type or namespace name 'PXAddAtttributeColumnsAttribute' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\SOLine.cs(30): error CS0246: The type or namespace name 'PXAddAtttributeColumns' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\SOLine.cs(31): error CS0246: The type or namespace name 'CSAnswerType' could not be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\PXAddAttributeColumns.cs(6): error CS0246: The type or namespace name 'CRAttributesFieldAttribute' could not be found (are you missing a using directive or an assembly reference?)
Compiler time, in seconds: 3.4108918
Validation failed.

Does anyone know why this might be failing validation or where I am going wrong?  

 

Thank you


Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,528 Topics
  • 10.9 K Posts
  • 35 Online
  • 2,414 Members
Our newest member: Megan Pawlowski
Latest Post: Credit Reference Report Needed
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

  • russ
Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2026 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×