0
votes

I added a few user defined fields to StockItem recently, added values to a few records, then attempted to search by value for them. The search engine is not aware of my UDF values unfortunately.

Is there a way to have user defined fields searchable?

1
The search engine does not gain awareness of your custom field automatically, but you can customize the NoteID field to update the PXSearchable attribute and give awareness to your field. If you have done this, can you post your customized NoteID field definition (specifically the PXSearchable attribute) which is used to define the universal search? I have successfully made a field of a DAC extension searchable in universal search. - Brian Stevens

1 Answers

0
votes

Yes, as Brian indicated we need to add a PXSearchable attribute for the NoteID field of that particular DAC. The below code from the SOOrder DAC file and it may help you to achieve your requirement.

    #region NoteID
    public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
    protected Guid? _NoteID;
    [**PXSearchable**(SM.SearchCategory.SO, "{0}: {1} - {3}", new Type[] { typeof(SOOrder.orderType), typeof(SOOrder.orderNbr), typeof(SOOrder.customerID), typeof(Customer.acctName) },
       new Type[] { typeof(SOOrder.customerRefNbr), typeof(SOOrder.customerOrderNbr), typeof(SOOrder.orderDesc) },
       NumberFields = new Type[] { typeof(SOOrder.orderNbr) },
       Line1Format = "{0:d}{1}{2}{3}", Line1Fields = new Type[] { typeof(SOOrder.orderDate), typeof(SOOrder.status), typeof(SOOrder.customerRefNbr), typeof(SOOrder.customerOrderNbr) },
       Line2Format = "{0}", Line2Fields = new Type[] { typeof(SOOrder.orderDesc) },
       MatchWithJoin = typeof(InnerJoin<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>),
       SelectForFastIndexing = typeof(Select2<SOOrder, InnerJoin<Customer, On<SOOrder.customerID, Equal<Customer.bAccountID>>>>)
   )]
    [PXNote(new Type[0], ShowInReferenceSelector = true, Selector = typeof(
        Search2<
            SOOrder.orderNbr,
        LeftJoinSingleTable<Customer, 
            On<SOOrder.customerID, Equal<Customer.bAccountID>,
            And<Where<Match<Customer, Current<AccessInfo.userName>>>>>>,
        Where<
            Customer.bAccountID, IsNotNull,
            Or<Exists<
                Select<
                    SOOrderType,
                Where<
                    SOOrderType.orderType, Equal<SOOrder.orderType>,
                    And<SOOrderType.aRDocType, Equal<ARDocType.noUpdate>>>>>>>,
        OrderBy<
            Desc<SOOrder.orderNbr>>>))]
    public virtual Guid? NoteID
    {
        get
        {
            return this._NoteID;
        }
        set
        {
            this._NoteID = value;
        }
    }
    #endregion