3
votes

User requirement is to add universal search for the new screen, added our new screen under Inventory Module also the new screen is not entry screen it is just like user view screen so in that DAC for note id field we have added searchable attribute but it does not work.

Can someone please help me with sample code or correct me where i am doing wrong. Also let me know is it possible to add searchable attribute for the new screens or not in Acumatica?

Thanks in advance.

 #region Noteid
        public new abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
        protected Guid? _Noteid;
        [PXSearchable(PX.Objects.SM.SearchCategory.All , "{0}", new Type[] { typeof(KWLotSerialDetails.lotSerialNbr) },
            new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID)},
            NumberFields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr) },
              Line1Format = "{0}{1}", Line1Fields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID)},
              Line2Format = "{1}{2}", Line2Fields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID) })]

        public virtual Guid? Noteid
        {
            get
            {
                return this._Noteid;
            }
            set
            {
                this._Noteid = value;
            }
        }
        #endregion
1

1 Answers

1
votes

You absolutely can add universal search to custom tables. Search is added to a DAC, not a screen, so it doesn't matter about using in a "user view screen". When the full-text index is rebuilt, your NoteID field is processed into the SearchIndex table.

I may be wrong, but I also think you need to convert your Noteid field to NoteID/noteID for this to work properly. C# is case sensitive, and FullIndexRebuild.cs contains: entity.GetNestedType("noteID") ... so I think it is not finding your Noteid/noteid field because of this.

One of my custom PXSearchable NoteID fields:

#region NoteID
[PXNote]
[PXSearchable(PX.Objects.SM.SearchCategory.IN, "{0}",
    new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    NumberFields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    Line1Format = "{0}", Line1Fields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    Line2Format = "{0}", Line2Fields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    WhereConstraint = typeof(Where<Current<SSINItemManufacturer.isActive>, NotEqual<False>>),
    MatchWithJoin = typeof(InnerJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<SSINItemManufacturer.inventoryID>>>),
    SelectForFastIndexing = typeof(Select2<SSINItemManufacturer, InnerJoin<InventoryItem, On<SSINItemManufacturer.inventoryID, Equal<InventoryItem.inventoryID>>>>)
    )]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
#endregion

Also check that your DAC is "known" by the "Rebuild Full-Text Entity" screen. Check screen SM209500 to make sure your DAC is listed, and if so, try rebuilding the full-text index on it.