Solved

Add the Inventory Item Xref (Cross Reference Table) to the Global Search

  • 16 June 2023
  • 5 replies
  • 358 views

Userlevel 4
Badge +2

Does anyone know how to add tables to the those read by the Full-Entity Index? Customer would like to search for Alternate part numbers and have the stock item/non stock item appear

Currently there is no good way to find this information, except from the SO, PO or SVO/Appointment screens with the Add Items button.

Knowing this would also be handy for my own customizations/add ons.

 

 

icon

Best answer by Troy Vars 24 June 2023, 05:54

View original

5 replies

Userlevel 2

Hi @Troy Vars.
The addition of DAC to the Global DAC search is configured by the PXSearchable attribute declared on a NoteID DAC field. You can find detailed information in our help articles:

There is also a good blog post with the guide to the addition of global DAC search to your DAC:
https://www.acumatica.com/blog/technical-tuesday-universal-search-in-acumatica/

Userlevel 4
Badge +2

 

Hi @snikomarov36,

This is a very good article and gets me 90% of the way there.

However, INItemXRef doesnt appear to have a NoteID field.

SO I tried to use the Inventory Item NoteID and add the search term to the PXSearchable box there

Now my Search term does not correctly return the INItemClass nor is it able to see the INItemXRef data. I expected this would work similarly to how the AP Example “sees” the Vendor data…

What am I missing?

   [PXNonInstantiatedExtension]
public class IN_InventoryItem_ExistingColumn : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
#region NoteID
[PXSearchable(SM.SearchCategory.IN, "{0}: {1}, {2}", new Type[] { typeof(InventoryItem.itemType), typeof(InventoryItem.inventoryCD), typeof(INItemXRef.alternateID) },
new Type[] { typeof(InventoryItem.descr) },
NumberFields = new Type[] { typeof(InventoryItem.inventoryCD) },
Line1Format = "{0}{1}", Line1Fields = new Type[] { typeof(INItemClass.itemClassCD), typeof(INItemClass.descr) },
Line2Format = "{0}{1}", Line2Fields = new Type[] { typeof(InventoryItem.descr), typeof(InventoryItem.baseUnit)},
WhereConstraint = typeof(Where<InventoryItem.itemStatus.FromCurrent.IsNotEqual<InventoryItemStatus.unknown>>)
)]
[PXNote(PopupTextEnabled = true)]
public Guid? NoteID { get; set; }
#endregion
Results of Search

 

Userlevel 2

Hi @Troy Vars.
The global DAC search mechanism requires declared Guid NoteID DAC field with PXNote attribute and PXSearchable attribute. If you add some information from  INItemXRef  to  InventoryItem, even if the search would start displaying new search results, the user will still navigate to InventoryItem from them, not to INItemXRef.

On the other hand, INItemXRef DAC does not declare default navigation with PXPrimaryGraph attribute, so the global DAC search still won’t work for it because DAC search relies on default navigation to navigate from search results to actual records.

If you take the approach with an extension to InventoryItem then there are few remarks:

  • First, it’s not very good to override all DAC field property attributes. If attributes on a base DAC change, the copy pasted set of attributes will become inconsistent with them. It’s better to minimize the changed attributes in DAC extension with PXMergeAttributesAttribute. Here is the article about this attribute:
       - https://help.acumatica.com/(W(193))/Help?ScreenId=ShowWiki&pageid=664aaeee-0bdc-427f-83da-bd931823c668
      - https://help.acumatica.com/(W(194))/Help?ScreenId=ShowWiki&pageid=d0634e8a-3a21-454c-963a-6741e7ec8390  (the same attribute can be applied in graph extensions)
    You can do things like this:
    [PXMergeAttributes(Method = MergeMethod.Merge)]
    [PXSearchable(...)] //Your customized attribute, PXNote left untouched
    public virtual Guid? NoteID { get; set; }

     

  • Now regarding your PXSearchable attribute declaration. Unfortunately, for DAC search things become complex when you try to use values from a different DAC in search results. It’s not yet described but it is in the plans of our documentation team.
     - First of all, the DAC with the PXSearchable declaration should have some foreign key DAC field storing the reference to the related DAC and PXSelector on it. You can’t have one to many relationship here where you have one DAC with PXSearchable attribute and many related DACs. A foreign key to the particular DAC record is needed. I have a feeling that for INItemXRef this is the case. Am I correct? If yes, then in this case you can’t go InventoryItem route. I would suggest to try to experiment with adding NoteID field in DAC extension for INItemXRef. Don’t forget that for existing data some GUIDs should be generated and filled. You will also need to add the default navigation via PXPrimaryGraph to INItemXRef in the DAC extension. You can override default navigation that way:
    https://help.acumatica.com/(W(195))/Help?ScreenId=ShowWiki&pageid=1dceb511-4e98-3700-7d7f-231688a7ac74
  • If the relationship between DACs is not one to many then you need to find the selector field for it, and make sure it comes in the title fields array before fields of related DAC. In fact, you group it like this:
    <one of field sets of the PXSearchable attribute>: [<fields from the declaring DAC>, typeof(selectorField1), <fields from related DAC 1>, typeof(selectorField2), <fields from related DAC 2>]

    There is more detailed description in the attachement

Userlevel 2
Badge

Hello @Troy Vars!

If you have the WMS feature (Inventory and Order Management → Warehouse Management → Inventory Operations) turned on, you can use the Item Lookup screen (IN202520) to search items by their xrefs/barcodes.

Userlevel 4
Badge +2

@snikomarov36 

Agreed what I was saying 

Hi @Troy Vars.
The global DAC search mechanism requires declared Guid NoteID DAC field with PXNote attribute and PXSearchable attribute. If you add some information from  INItemXRef  to  InventoryItem, even if the search would start displaying new search results, the user will still navigate to InventoryItem from them, not to INItemXRef.

 

Yep, the merge attributes didnt work so I tried a few other methods before using the override on InventoryItem I shared here. Given this was a Proof of Concept on a local dev environment. Not sure my concern was upgradability over functionality, but I get the mentioned for others stumbling on this article
If you take the approach with an extension to InventoryItem then there are few remarks:

 

This is the crux of the matter since the global type of XRef would be one to one but the Customer/Vendor would be one to many this will not work with the current Xref table.

Sad the documentation was not up to date could have saved some effort :(. Thank you for finding that btw.

  • Now regarding your PXSearchable attribute declaration. Unfortunately, for DAC search things become complex when you try to use values from a different DAC in search results. It’s not yet described but it is in the plans of our documentation team.
     - First of all, the DAC with the PXSearchable declaration should have some foreign key DAC field storing the reference to the related DAC and PXSelector on it. You can’t have one to many relationship here where you have one DAC with PXSearchable attribute and many related DACs. A foreign key to the particular DAC record is needed. I have a feeling that for INItemXRef this is the case. Am I correct? If yes, then in this case you can’t go InventoryItem route. I would suggest to try to experiment with adding NoteID field in DAC extension for INItemXRef. Don’t forget that for existing data some GUIDs should be generated and filled. You will also need to add the default navigation via PXPrimaryGraph to INItemXRef in the DAC extension. You can override default navigation that way:
    https://help.acumatica.com/(W(195))/Help?ScreenId=ShowWiki&pageid=1dceb511-4e98-3700-7d7f-231688a7ac74
  • If the relationship between DACs is not one to many then you need to find the selector field for it, and make sure it comes in the title fields array before fields of related DAC. In fact, you group it like this:
    <one of field sets of the PXSearchable attribute>: [<fields from the declaring DAC>, typeof(selectorField1), <fields from related DAC 1>, typeof(selectorField2), <fields from related DAC 2>]

    There is more detailed description in the attachement

 

I think the Options for my client are the following unless there is another suggestion:

  1. Use a GI which means navigating to another screen from Quotes and Projects like @slesin suggests 
  2. Create a custom cross reference table with Navigation to replicate what Acumatica has done…
  3. Create custom Selectors with the Alternate ID and filter by the Global alternate type… on every screen it is missing
  4. Wait for this functionality to work with one to many or be added to global search
  5. Wait for one of the Add Item buttons to be added to these screens like it was for Field Service a few versions back. Hopefully we can see this added globally to some of these other screens that utilize inventory.  (SO, PO and FS have it added just need CRM, AM, PJ and the like) 

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