Reputation: 163
I am trying to add Selector Fields into a grid. These selectors are not bound to any data on the grid as it's just for data entry so there is no filtering. I am wanting to add the Item Class and Price Class on the Shipping Terms grid.
This is my code:
using PX.Data;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.IN;
using PX.Objects.AR;
using PX.Objects;
using System.Collections.Generic;
using System;
namespace PX.Objects.CS
{
public class ShipTermsDetailExt : PXCacheExtension<PX.Objects.CS.ShipTermsDetail>
{
#region priceCode
public abstract class priceCode : PX.Data.IBqlField
{
}
[PXString]
[PXUIField(DisplayName="Price Code")]
[PXSelector(typeof(Search<ARPriceClass.PriceClassID>),
typeof(ARPriceClass.Description),
SubstituteKey = typeof(ARPriceClass.Description),
ValidateValue = false)]
public virtual string UsrPriceCode { get; set; }
#endregion
#region itemClass
public abstract class itemClass : PX.Data.IBqlField
{
}
[PXString]
[PXUIField(DisplayName="Item Class")]
[PXSelector(typeof(Search<INItemClass.ItemClassID>),
typeof(INItemClass.ItemClassCD),
SubstituteKey = typeof(INItemClass.ItemClassCD),
ValidateValue = false)]
public virtual string UsrItemClass { get; set; }
#endregion
}
}
However I am getting these errors:
Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\ShipTermsDetail.cs(20): error CS0118: 'PX.Objects.AR.ARPriceClass.PriceClassID' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(21): error CS0118: 'PX.Objects.AR.ARPriceClass.Description' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(22): error CS0118: 'PX.Objects.AR.ARPriceClass.Description' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(33): error CS0118: 'PX.Objects.IN.INItemClass.ItemClassID' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(34): error CS0118: 'PX.Objects.IN.INItemClass.ItemClassCD' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(35): error CS0118: 'PX.Objects.IN.INItemClass.ItemClassCD' is a 'property' but is used like a 'type'
\App_RuntimeCode\ShipTermsDetail.cs(20): error CS0118: 'PX.Objects.AR.ARPriceClass.PriceClassID' is a 'property' but is used like a 'type'
Since these two fields are not bound by what is selected in the first couple of columns, I didn't think a .this or base would be needed but I could be wrong?
Upvotes: 0
Views: 320
Reputation: 163
Remember to watch the naming convention in Acumatica customizations. I just had to change the fields to lowercase for the first letter.
Here is the fixed code:
using PX.Data;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.IN;
using PX.Objects.AR;
using PX.Objects;
using System.Collections.Generic;
using System;
namespace PX.Objects.CS
{
public class ShipTermsDetailExt : PXCacheExtension<PX.Objects.CS.ShipTermsDetail>
{
#region priceCode
public abstract class priceCode : PX.Data.IBqlField
{
}
[PXString]
[PXUIField(DisplayName="Price Code")]
[PXSelector(typeof(Search<ARPriceClass.priceClassID>),
typeof(ARPriceClass.description),
SubstituteKey = typeof(ARPriceClass.description),
ValidateValue = false)]
public virtual string UsrPriceCode { get; set; }
#endregion
#region itemClass
public abstract class itemClass : PX.Data.IBqlField
{
}
[PXString]
[PXUIField(DisplayName="Item Class")]
[PXSelector(typeof(Search<INItemClass.itemClassID>),
typeof(INItemClass.itemClassCD),
SubstituteKey = typeof(INItemClass.itemClassCD),
ValidateValue = false)]
public virtual string UsrItemClass { get; set; }
#endregion
}
}
Upvotes: 1