Solved

Add Custom Columns to InventoryID lookup in Sales Orders

  • 5 October 2023
  • 17 replies
  • 244 views

Userlevel 4
Badge

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.Caches[typeof(InventoryItem)]);
PXSelectorAttribute.SetColumns(Base.Caches[typeof(SOLine)],
"InventoryID", new string[] { "InventoryCD", "Descr", "itemClassID", "Color_ATTRIBUTES" },
new string[] { "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…

Does anyone know?

 

 

 

icon

Best answer by dcomerford 19 October 2023, 11:24

View original

17 replies

Userlevel 5
Badge +2

@mjgrice32 Try using PXCustomizeSelectorColumns attribute, here’s a guide on how to do that:
https://asiablog.acumatica.com/2015/10/customizing-selector-attributes.html

Userlevel 4
Badge

@mjgrice32 Try using PXCustomizeSelectorColumns attribute, here’s a guide on how to do that:
https://asiablog.acumatica.com/2015/10/customizing-selector-attributes.html

 

OK, I think I understand what you are saying. I’m going to go check. Thanks!

 

 

 

 

Userlevel 7
Badge +10

Hi @mjgrice32 ,

If you want to add standard fields to the selector, you can follow below link to achieve the same.

Add standard field to the selector/lookup of Acumatica - Acumatica – Tips, Tricks and Components (greytrix.com)

Hope, it helps!

Regards,

Sweta

Userlevel 4
Badge

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?

Userlevel 7
Badge +17

@mjgrice32  Please review below article which helps you to solve this problem.

https://asiablog.acumatica.com/2017/05/filtering-inventory-items-by-new-field.html

Userlevel 7
Badge +12

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

 

 

Userlevel 4
Badge

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
[PXDBString]
[PXUIField(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?

 

 

Userlevel 4
Badge

@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...)

 

Userlevel 4
Badge

@mjgrice32  Please review below article which helps you to solve this problem.

https://asiablog.acumatica.com/2017/05/filtering-inventory-items-by-new-field.html

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?

 

Userlevel 7
Badge +12

@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.

Userlevel 4
Badge

@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!

Userlevel 7
Badge +12

@mjgrice32 Here is the package with it working you needed to set the FastFilterFields

 

Userlevel 4
Badge

@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?

Userlevel 7
Badge +12

@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

 

Userlevel 4
Badge

@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?

Userlevel 4
Badge

@dcomerford I’m curious, what version of Acumatica were your running when you created the package you sent me?

Userlevel 7
Badge +12

It was 23R2 my latest test system

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved