abulger
abulger

Reputation: 101

Accessing user-defined fields added via an extension in Acumatica

I have a custom field called 'UsrIsTeacherBook` which was added to the InventoryItem with the following extension:

namespace Lasalle.TeacherBooks
{
    public class InventoryItem_TeacherBooks_Extension : PXCacheExtension<InventoryItem>
    {
        [PXDBBool]
        [PXUIField(DisplayName = "Is Teacher Book")]
        public virtual bool? UsrIsTeacherBook { get; set; }
        public abstract class usrIsTeacherBook : IBqlField { }
    }
}

I need to be able to access the value of this IsTeacherBook field from the SOLine grid on the SalesOrder screen. I added a custom field UsrTeacherBook to the SOLine grid on the sales order screen, but I cannot figure out how to populate this field with the value of InventoryItem UsrIsTeacherBook.

I tried customizing the attributes on the SOLine field in the following way:

[PXDBBool]
[PXUIField(DisplayName="Teacher Manual", Visible = true, Enabled = false)] 
[PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItemExt.usrIsTeacherBook>))]

But this produced a validation error, "The type name 'usrIsTeacherBook' does not exist in the type 'PX.Objects.IN.InventoryItemExt'."

What is the correct way to access the InventoryItem IsTeacherBook field to populate my field on the SOLine grid?

Upvotes: 0

Views: 557

Answers (1)

RuslanDev
RuslanDev

Reputation: 6778

Your extension class name is InventoryItem_TeacherBooks_Extension, not InventoryItemExt used in PXFormulaAttribute. You should either change your extension name to InventoryItemExt or modify PXFormula declaration with InventoryItem_TeacherBooks_Extension.usrIsTeacherBook

Upvotes: 0

Related Questions