Naming Rule Scripts

When new objects are created, the object names do not have to be entered manually. You can define rules to automatically name these objects. Customised automatic naming allows users to reduce the amount of time in renaming objects from the default naming structure to a more meaningful name. Ideally the system should allocate the next name of an object, with the users only needing to confirm the name. This makes following correct business rules easy and produces consistency in naming. Naming rule scripts are unique to each customer.

A simple naming change would be to alter the mask of the naming rule or the latest used counter value, and a more complex naming change would be to use a script to determine the next name for an object, in accordance with the individual customer's requirements. See Set up Naming Rules.

Unlike Object Event Scripts, there is only one naming script. Each object that requires a generated name must contain a class that implements the INameGenerator interface within the Named Object Generator (script editor).

Formal Definition

Copy
public interface INameGenerator
{
    string[] GetParameterMap();

    string GetName(string[] paramList);

    string GetName(BTNamedBusinessObject obj, ValidationInfo info, out 
        ScriptResult scriptResult);
}

Methods

GetParameterMap

Returns a list of strings describing the required parameters for generation of a name for an object. Used for testing purposes.

GetName

Displays a test that can be used for testing generation of a name for an object.

Generates and returns a name based on a list of strings described in the GetParameterMap method. Called by the script test form.

The paramList is the list of strings used to generate a name for an object in the same order that the GetName method describes.

GetName (out)

Generates the name for an object. This method is called by the NameGenerator class.

This method has the following parameters:

  • obj—The business object for which a name is required.
  • info—The validation info object, which may be null and allows validation messages to be returned if conditions are not met to generate a valid name.
  • scriptResult—Holds the return value of the script.