Skip to main content

Is there a way to add the customer location into the global search.  As a field service company, the only thing we care about is the customer location because that is what all of our work is attached to.  Currently the global search doesn’t search for anything having to do with the customer location.

This should be possible by a small customization.  If you have a developer resource, they can create a DAC extension in CR.Location on the NoteID field to add Location to the Global Search.  You will need to specify what fields you want searchable and displayed.  The potential downside is that the Location DAC is used for more than just customer locations, so if you only wanted customer locations, you will be getting more locations than you bargained for.

The PXSearchable attribute is what adds a DAC to the Universal (Global) Search.  The following is an example from the InventoryItem DAC on 2021R1.  Focus on just the PXSearchable attribute.  For this to be possible, the DAC (table) you want to include in the Universal Search must contain the NoteID field.  Also worth nothing, custom tables can be added with NoteID and added to Universal Search in the same way.  You will want to be sure run the Rebuild Full-Text Entity Index screen id SM209500 to populate the Universal Search.

#region NoteID
/// <summary>
/// Identifier of the <see cref="PX.Data.Note">Note</see> object, associated with the item.
/// </summary>
/// <value>
/// Corresponds to the <see cref="PX.Data.Note.NoteID">Note.NoteID</see> field.
/// </value>

rPXSearchable(SM.SearchCategory.IN, "{0}: {1}", new Type,] { typeof(itemType), typeof(inventoryCD) },
new Type>] { typeof(descr) },
NumberFields = new Type=] { typeof(inventoryCD) },
Line1Format = "{0}{1}{2}", Line1Fields = new Type=] { typeof(INItemClass.itemClassCD), typeof(INItemClass.descr), typeof(baseUnit) },
Line2Format = "{0}", Line2Fields = new Type=] { typeof(descr) },
WhereConstraint = typeof(Where<itemStatus.FromCurrent.IsNotEqual<InventoryItemStatus.unknown>>)
)]

rPXNote(PopupTextEnabled = true)]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : BqlGuid.Field<noteID> { }
#endregion

When I researched this a few years ago, we had some discussion on Stack Overflow.  You can read that discussion here and see the example.


Reply