0

i would like to Hide the column(except Inventory ID and Description) in the "Expense Item" Lookup screen on the Expense Receipt screen(EP301020) for all the users.

How can i set that some columns (which are not needed) in the "Available column" section in "Column Configuration" by default for all the users and only the required ones are available in the lookup screen.By default, all the columns are included in the selected column list in the Column Configuration. Please advise. Thanks

A. Acuman
  • 1
  • 2
  • It is not clear to me whether you want to have the columns in Selected list box go in Available list box or if you want to remove columns from both list box. – Hugues Beauséjour Feb 07 '19 at 17:01
  • Anyway, I posted a solution which completely removes the column from both list box as I think this is what you asked for. – Hugues Beauséjour Feb 07 '19 at 19:18
  • Hi, thanks for your response. Actually i would like to move the Column in Selected List box into the Available list box so that only Inventory ID and Name left in the Selected list box. – A. Acuman Feb 07 '19 at 22:39
  • I believe that functionality is available out-of-box without customization. In a way you can't force that because column configuration is configured per user and by the user. You can set the columns you want in UI and it will be remembered next time you open that page. Now all you'd need is to initialize the visible columns for all user, documentation covers that feature here: https://help-2018r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=30f3229f-20f1-4055-9c03-e0fe3b37080d – Hugues Beauséjour Feb 08 '19 at 15:15
  • Seems like this functionality is only applicable to the main Grid( transaction detail section) and not on the columns in the Finders. – A. Acuman Feb 12 '19 at 10:59
  • You're right, selector popup windows have many limitations. – Hugues Beauséjour Feb 12 '19 at 15:08

1 Answers1

1

Below is code to hide the columns from Available and Selected list box. If all you need is to initialize the columns in Available and Selected list box consider using Acumatica Default Table Layout feature. Note that column configuration is a user configuration so you can initialize the columns but you can't override the user choices after initialization.


To completely remove the columns from the selector you need to redefine the InventoryID selector and explicitly declare the columns you want to see in the second parameter of PXSelector.

You can do so by creating a graph extension on ExpenseClaimDetailEntry and using CacheAttached method to redefine the selector:

using PX.Data;
using PX.Objects.IN;

namespace PX.Objects.EP
{
    public class ExpenseClaimDetailEntry_Extension : PXGraphExtension<ExpenseClaimDetailEntry>
    {
        [PXMergeAttributes(Method = MergeMethod.Replace)]
        [PXDefault]
        [PXUIField(DisplayName = "Expense Item")]
        [PXSelector(typeof(InventoryItem.inventoryID), 
                    /* List of available/visible columns go here */
                    new Type[] { typeof(InventoryItem.inventoryCD), 
                                 typeof(InventoryItem.descr) }, 
                    SubstituteKey = typeof(InventoryItem.inventoryCD),
                    DescriptionField = typeof(InventoryItem.descr))]
        [PXRestrictor(typeof(Where<InventoryItem.itemType, Equal<INItemTypes.expenseItem>>), Messages.InventoryItemIsNotAnExpenseType)]
        protected virtual void EPExpenseClaimDetails_InventoryID_CacheAttached(PXCache sender)
        {
        }
    }
} 

enter image description here

Hugues Beauséjour
  • 8,067
  • 1
  • 9
  • 22