How to create a field with an automated counter in a business object.

Version 1

    Details

    Steps to create a field with an automated counter in a business object.

    Example: A customer would like to automatically assign a unique ID when creating a new record in a business object.

     


    Resolution

    1. Create the Counter:

     - Log into the AdminUI under the Administrator role
     - Go to Settings > Build > Counters
     - Click 'Add New': A blank counter form appears
     - Enter information into the fields.
    Name - This is the name that will be used in the initialization business rule for the business object to get the next counter value.
    Base Value - The first or initial integer value for the counter. This could also be a negative number. Counter length is limited to 9 digits.
    Increment - The incremental counter value for the next record.
     - Save

    2. Create a Number field on your Business Object (add to form\grid as needed)
     - Type Specific Information
    Total Number Of Digits: 10
    Precision: 0

    3. Create the business rule to create a new counter value for each new record.
     -  Under the Business Object > Business Rule: Create a new initialization rule
     -  Choose the Business Rules tab. The list of business rules appears.
     - Within the Initialization Rules section, click 'Add Initialization Rule'. The Add Initialization Rule window appears.
     - Enter information into the fields.on
      Field Name The field in which this initialization rule applies (Number field you previously created)
    Field Value Enter the expression: $(GetNextCounter(CounterName))
     - Save.