Rename Column At Screen In Acumatica
Hello everybody,
today I want to share answer at simple question how to change the caption at some screen.
For example you want to change caption at screen AR202000 for Inventory ID to caption INVENTORY ID.
For this purpose we need to understand which DAC is responsible for Grid. For this puprose we can open page AR202000.
There we can see the following line:
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" PrimaryView="Filter" TypeName="PX.Objects.AR.ARSalesPriceMaint">
So it means that for Graph or controller we will check ARSalesPriceMaint.
For field inventory id responsible code
<px:PXSegmentMask ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True">
and view which we need is named
<px:PXGridLevel DataMember="Records">
Lets navigate to class PX.Objects.AR.ARSalesPriceMaint with help of reflector ( one of my favorite tools ).
Find there member Records which is declared in the following way:
public SalesPriceProcessing<ARSalesPrice, InnerJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<ARSalesPrice.inventoryID>>, LeftJoin<INItemCost, On<INItemCost.inventoryID, Equal<InventoryItem.inventoryID>>>>, Where<ARSalesPrice.custPriceClassID, Equal<Current<ARSalesPriceFilter.custPriceClassID>>, And2<Where<Current<ARSalesPriceFilter.curyID>, IsNull, Or<ARSalesPrice.curyID, Equal<Current<ARSalesPriceFilter.curyID>>>>, And<ARSalesPrice.isPromotionalPrice, Equal<Current<ARSalesPriceFilter.promotionalPrice>>, And<InventoryItem.itemStatus, NotEqual<INItemStatus.inactive>, And<InventoryItem.itemStatus, NotEqual<INItemStatus.toDelete>, And<Where2<Where<Current<ARSalesPriceFilter.itemClassID>, IsNull, Or<Current<ARSalesPriceFilter.itemClassID>, Equal<InventoryItem.itemClassID>>>, And2<Where<Current<ARSalesPriceFilter.inventoryPriceClassID>, IsNull, Or<Current<ARSalesPriceFilter.inventoryPriceClassID>, Equal<InventoryItem.priceClassID>>>, And2<Where<Current<ARSalesPriceFilter.ownerID>, IsNull, Or<Current<ARSalesPriceFilter.ownerID>, Equal<InventoryItem.priceManagerID>>>, And2<Where<Current<ARSalesPriceFilter.myWorkGroup>, Equal<boolFalse>, Or<InventoryItem.priceWorkgroupID, InMember<CurrentValue<ARSalesPriceFilter.currentOwnerID>>>>, And<Where<Current<ARSalesPriceFilter.workGroupID>, IsNull, Or<Current<ARSalesPriceFilter.workGroupID>, Equal<InventoryItem.priceWorkgroupID>>>>>>>>>>>>>>, OrderBy<Asc<ARSalesPrice.inventoryID, Asc<ARSalesPrice.uOM, Asc<ARSalesPrice.lastDate>>>>> Records;
Looks scarry, huh? For me in the begining of my way also. But lets continue.
DataField="InventoryID" means that this field is declared in class ARSalesPrice.
Just for example lets say that DataField looked in the following way:
DataField="InventoryItem__InventoryID". That mean that we need to search for class InventoryItem.
Lets navigate with reflector to class ARSalesPrice and find there field InventoryID.
It's declared in the following way:
[Inventory(DisplayName="Inventory ID"), PXDefault, PXParent(typeof(Select<InventoryItem, Where<InventoryItem.inventoryID, Equal<Current<inventoryID>>>>))] public virtual int? InventoryID { get { return this._InventoryID; } set { this._InventoryID = value; } }
Then do the following:
1. create class ARSalesPriceExt like this:
public class ARSalesPriceExt : PXCacheExtension< ARSalesPrice> {
2. In the class declare the following member:
[Inventory(DisplayName="INVENTORY ID"), PXDefault, PXParent(typeof(Select<InventoryItem, Where<InventoryItem.inventoryID, Equal<Current<inventoryID>>>>))] public virtual int? InventoryID { get { return this._InventoryID; } set { this._InventoryID = value; } }
3. Build class library and reference it in your Acumatica web site and congratulations, you have changed caption in grid