Add Custom Columns to InventoryID lookup in Sales Orders
I will need to do this in four different Graphs, but let’s start with the most common one: Sales Orders.
When entering an InvertoryID in Sales Order Detail (SOLine) Acumatica does a search inside VendorID --using the InventoryCD as well as Inventory Description-- as they enter the item:
My customer has two more fields they would like to also search on. But these fields do not exist in the default InventoryItem DAC.
There is a post on StackOverflow that describes how to add columns to the search (I think) ...
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry> { public override void Initialize() { base.Initialize(); //for InventoryID lookup CR.CRAttributesFieldAttribute.Activate(Base.CachesCtypeof(InventoryItem)]); PXSelectorAttribute.SetColumns(Base.CachesCtypeof(SOLine)], "InventoryID", new strings] { "InventoryCD", "Descr", "itemClassID", "Color_ATTRIBUTES" }, new strings] { "InventoryCD", "Descr", "itemClassID", "$Attributes$-Color" }); } }
-- But what if the fields were extended fields added to the InventoryItem DAC?
Or what if the field is an extension field added to the VENDOR DAC (linked via the PreferredVendor field)?
How could I add this to the Inventory search? (If the second request is too complicated, I can just go with adding the two fields to the InventoryItem DAC.)
I’ve looked around but don’t see anything for this use case -- but I’m pretty sure that this must have been a need for someone else…
OK, I have had some time to come back around to this and it still is not working.
There are two solutions here, and I am a little confused about how they are supposed to be used.
In ]the post suggested by Sweta68 ( add-standard-field-to-the-selector) the adding is done via the IIS App. When I follow the steps (as best as I can since the versions seem different) I end up with this:
Which gives me this when I run it:
But It can’t find anything when I search with the extended description:
I feel like I am missing a step. Isn’t there some method or event I need to override, or something?
@mjgrice32 Please review below article which helps you to solve this problem.
The PXCustomiseSelectorColumn only adds the column to the search grid so they can be used to filter the list using the column filters. If you want the standard search box to search through these columns then you will need to use the FastFilterFields to set which fields to search when you enter a value in the search box see below i have added ItemClass (you can use a comma to add multiple fields the help has an example. It is under the Level below the Grid Transactions
For some reason, this just isn’t working for me. I read through the Asia blog, @Naveen Boga sent, and I see @dcomerford reply, but… no luck here.
Here is the code change I made after reading the Asia blog:
public class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem> { #region UsrASGVendorXRef rPXDBString] rPXUIField(DisplayName = "Vendor CrossRef", Visibility = PXUIVisibility.SelectorVisible)] public virtual string UsrASGVendorXRef{ get; set; } public abstract class usrASGVendorXRef: PX.Data.BQL.BqlString.Field<usrASGVendorXRef> { } #endregion
And this is the change I made in the customization:
But when I search for this item by InventoryCD it finds it fine:
And when I search for it using the extended field… nothing.
I shut IIS down and restarted it. I refreshed the app pool. But nothing is working.
What am I doing wrong?
@dcomerford What version of Acumatica are you running?
(I am on 2022 R2, and I am wondering if it just doesn’t work in this version...)
@mjgrice32 Please review below article which helps you to solve this problem.
That didn’t work for me, either. I literally copied his code and followed his steps, and no luck.
I note that the post was from a few years ago. I am starting to wonder if this is a version problem?
@mjgrice32 I have it working on a site back to 21R1 so sure it is not a version issue. Can you send me your package and i can have a look. You do not need to do any ‘coding’ to make this work.
@mjgrice32 I have it working on a site back to 21R1 so sure it is not a version issue. Can you send me your package and i can have a look. You do not need to do any ‘coding’ to make this work.
Thank you so much!
Sure, here it is. It includes the database scripts to create the extended tables, and the changes I made to Sales Order screen. This is the one that tried to replicate Sergey’s example exactly.
If you need the source code, LMK. There is nothing in it that is proprietary, this is just me trying to figure out how to do this.
Thanks again!
@mjgrice32 Here is the package with it working you needed to set the FastFilterFields
@dcomerford OK… but I did that.
And, I was trying to add it in Sales Orders, actually, not Sales quotes. Did you see what I had done there? Did I define it incorrectly, or why isn’t it working in Sales Orders?
@mjgrice32 You did not have the FastFilterFields set on the InventoryID under the level on the Sales Order or the Selector Columns hence why i did the Sales Quote but here is package with it for the Sales Order and it is working
@dcomerford : First of all, thank you very much for your help.
I see I was doing my FastFilterFields in the wrong place. I was doing it in the Grid instead of the Level section. Thanks for that clarification.
However, none of these work in the detail line on the sales quotes (nor the Sales Orders) screen. In the default behavior, when the user is entering a value in the InventoryID field, the can automatically get the value, without needing the popup. This works (using an InventoryCD) :
And this (using the extended field) does not:
Even though it does via the popup box:
So, to get that behavior, do I have to write my own verify function on the field and do the lookup myself then?
@dcomerford I’m curious, what version of Acumatica were your running when you created the package you sent me?