M3_H5_SearchCustomFields

Use this script to assist with building Infor Enterprise Search queries over custom fields that are either alphanumeric or numeric as set up in 'Custom Field. Open' (CMS470).

Limitation

The query does not work for custom date fields.

Prerequisites

  • Define the custom field in 'Custom Field. Open' (CMS470).
  • Attach a custom field to a custom field group in 'Custom Field Group. Open' (CMS471).
  • Add the custom field group to item group or supplier group, then add the custom fields to an item, supplier, purchase agreement or purchase agreement line.
  • Before adding a script, you must activate the table MITMAS in the M3 Function Search administration.

    See information about updating table indexes in the M3 Core User and Administration Library (Cloud).

Script arguments

  • Argument to be used on 'Item. Open' (MMS001) to search all items containing the required custom field. Optionally, you may filter the results by specifying an item status, item type or responsible in (MMS001).

    Search Custom Fields,1,1

    This table shows the elements in the argument and their corresponding descriptions:
    Argument Example Optional Descriptions
    Button name SearchCustomFields No You can use any button name which depends on your requirement.
    Target row for the button 1 No Specify any row selection based on your requirement.
    Target column for the button 1 No

    Specify any column selection based on your requirement.

  • Argument to be used on 'Item. Open Toolbox' (MMS200) to search only the items that contain the required custom field and meet the additional arguments. Before using the script, you are required to supply a warehouse number in (MMS200).

    Search Custom Fields,4,50,MITMAS,ITNO,ITNO,STAT:20

    The table MITMAS is connected to MTEINF using common key DTID (data key). If the script is to be used in a program where MITMAS is not the primary table, the arguments <related table>, <related to-key>, <related from-key>, <related query> are used to extend the query to connect the current table so that the field DTID can be found and used.

    This table shows the elements in the argument and their corresponding descriptions:
    Argument Example Optional Descriptions
    Button name SearchCustomFields No You can use any button name which depends on your requirement.
    Target row for the button 1 No Provide any row selection based on your requirement.
    Target column for the button 1 No

    Provide any column selection based on your requirement.

    Related table MITMAS Yes Provide the related table where to search the additional information. For this example, MITMAS holds the primary data for available items in M3.
    Related to-key ITNO Yes Similar to a reference key, this related to-key is to be used to search in the related table.
    Related from-key ITNO Yes Similar to a reference key, this related from-key is to be used to search in the related table.
    Related query STAT:20 Yes Used as a query for filtering results.

    For this example, only items with status 20 are filtered and displayed.

Setting the conditions in the condition builder dialog

  1. Click the added button from the program’s B panel.
  2. Specify this information:
    Field group
    Select a field group where to perform the search for a custom field.
    Custom field
    Select an available custom field.
    Value
    Select or specify a value used by the custom field. Since the script also handles numeric fields, you can manually add ranges, for example [1 TO 2].
  3. Optionally, click the + operator to add more conditions or click the operator to delete excess conditions.
  4. Click Search.

APIs used in the script

This table shows details about M3 APIs used in this script:
Program Transaction
CMS471MI LstCustFieldGrp
CMS471MI LstCustPerGrp
EXPORTMI Select