API Formatted Searches


The FormattedSearches object enables to assign a formatted search function to a specified field, so that SAP Business One users can enter values, originated by a pre-defined search process, to the field. The formatted search is applicable for any field in the system including user defined fields.

Source table: CSHS.

Object Model


The mandatory properties include the FormID, ItemID, and ColumnID. The combination of these properties determines the key of the field for which the formatted search is applicable. Additional mandatory properties are according to the value of the Action property.

The following are examples of using the formatted search function:

  • Automatic entery of values into fields using various objects in the system.
  • Entering values into fields using a pre-defined list of valid values.
  • Automatic entery of values into fields by user-defined queries.
  • Creating dependency between fields in the system. That is, the value of field X influence the value of field Y.
  • Displaying fields that can only be displayed using queries such as, User Signature, Creation Date, Open Checks Balance (for business partner).

To display the form in the application:

  1. Open a document and click any field.
  2. From the menu bar, select Tools --> Search Function --> Define.
    The Define Formatted Search form opens.
  3. To view more fields, select the Search by Saved Query.

General Guidelines

Make sure to follow these guidelines, otherwise the system responds with the error -1003.

  • The formatted search query must refer to an existing field. For user-defined fields add the "U_" prefix.
  • The SQL syntax must be correct.
  • Add a Space character between the Equal sign (=) and the field/string before the Equal sign.
  • To compare a field of Alpha type to a variable such as [0], use a single quotation mark ' '[0]'.
  • Values must exist for the specified field before activating the formatted search function.

For more details, refer to SMB Portal (upper menu: Service and Support. left menu: Knowledge & Services --> Knowledge Base). Look for the Formatted Search document.

See Also

SAP® B1 DI-API C# definition

public class FormattedSearchesClass : IFormattedSearches, FormattedSearches { public virtual BoFormattedSearchActionEnum Action { get; set; } public virtual DataBrowser Browser { get; } public virtual BoYesNoEnum ByField { get; set; } public virtual string ColumnID { get; set; } public virtual string FieldID { get; set; } public virtual BoYesNoEnum ForceRefresh { get; set; } public virtual string FormID { get; set; } public virtual int Index { get; } public virtual string ItemID { get; set; } public virtual int QueryID { get; set; } public virtual BoYesNoEnum Refresh { get; set; } public virtual SAPbobsCOM.UserFields UserFields { get; } public virtual SAPbobsCOM.UserValidValues UserValidValues { get; } public extern FormattedSearchesClass(); public virtual extern int Add(); public virtual extern string GetAsXML(); public virtual extern bool GetByKey( int lIndex); public virtual extern int Remove(); public virtual extern void SaveToFile( string bstrFileName); public virtual extern void SaveXML( ref string pbstrFileName); public virtual extern int Update(); }

Related information

User Valid Values UserValidValues Object· Table: CUVV
UserValidValues is an object related to the FormattedSearches object. It enables to define valid values for the field specified by the FormattedSearches object. Source table: CUVV.
   Parent: Formatted Searches FormattedSearches Object· Table: CSHS

Bo Formatted Search Action Enum BoFormattedSearchActionEnum Enumeration
Specifies the types of action to be taken by the system when activating the formatted search function.
   Parent: Formatted Searches FormattedSearches Object· Table: CSHS

SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates