Add the Inventory Item Xref (Cross Reference Table) to the Global Search
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.
Page 1 / 1
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:
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?
rPXNonInstantiatedExtension] public class IN_InventoryItem_ExistingColumn : PXCacheExtension<PX.Objects.IN.InventoryItem> { #region NoteID >PXSearchable(SM.SearchCategory.IN, "{0}: {1}, {2}", new Typee] { typeof(InventoryItem.itemType), typeof(InventoryItem.inventoryCD), typeof(INItemXRef.alternateID) }, new Typee] { typeof(InventoryItem.descr) }, NumberFields = new Typee] { typeof(InventoryItem.inventoryCD) }, Line1Format = "{0}{1}", Line1Fields = new Typee] { typeof(INItemClass.itemClassCD), typeof(INItemClass.descr) }, Line2Format = "{0}{1}", Line2Fields = new Typee] { 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
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:
gPXMergeAttributes(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>: S<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
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.
@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:
aPXMergeAttributes(Method = MergeMethod.Merge)] oPXSearchable(...)] //Your customized attribute, PXNote left untouched public virtual Guid? NoteID { get; set; }
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:
Use a GI which means navigating to another screen from Quotes and Projects like @slesin suggests
Create a custom cross reference table with Navigation to replicate what Acumatica has done…
Create custom Selectors with the Alternate ID and filter by the Global alternate type… on every screen it is missing
Wait for this functionality to work with one to many or be added to global search
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)