The client wishes to use the universal search box, to search for values in a custom field. How can this be done?
In this case, I created a simple custom text field, for InventoryItem. Currently, it is not visible in the UI.
Let's refer to the custom UsrAlternateIDs field created in this example and include it into Acumatica's Full-Text Entity Index.
The only modification required to include UsrAlternateIDs field into Full-Text Entity Index is to replace the original declaration of PXSearchableAttribute used on the NoteID field in the InventoryItem DAC. As shown in the code snippet below, UsrAlternateIDs is now included into the fields type array passed as 3rd parameter to the new PXSearchableAttribute constructor:
[PXNonInstantiatedExtension]
public class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(PXSearchableAttribute))]
[PXSearchable(SM.SearchCategory.IN, "{0}: {1}",
new Type[] {
typeof(InventoryItem.itemType),
typeof(InventoryItem.inventoryCD) },
new Type[] {
typeof(InventoryItem.descr),
typeof(InventoryItemExt.usrAlternateIDs) },
NumberFields = new Type[] {
typeof(InventoryItem.inventoryCD),
typeof(InventoryItemExt.usrAlternateIDs) },
Line1Format = "{0}{1}{2}",
Line1Fields = new Type[] {
typeof(INItemClass.itemClassCD),
typeof(INItemClass.descr),
typeof(InventoryItem.baseUnit) },
Line2Format = "{0}",
Line2Fields = new Type[] {
typeof(InventoryItem.descr) },
WhereConstraint = typeof(Where<Current<InventoryItem.itemStatus>,
NotEqual<InventoryItemStatus.unknown>>)
)]
public Guid? NoteID { get; set; }
}
After you implement an InventoryItem extension following the sample above and rebuild Full-Text Entity Index on your Acumatica ERP instance, it should be possible to search for Inventory Items based on their Alternate IDs.