About Autonaming Business Objects

When a user creates a business object, it is often convenient and sometimes necessary for the system to create a unique name for the object. For example, when a user creates a Decision, the system creates a Decision object and generates a name automatically. This name becomes a unique ID that distinguishes the Decision from all other Decisions.

See Configuring Automatic Business Object Naming for instructions.

This page discusses:

Data Model for Automatic Naming

This diagram shows the data model for the automatic naming process.

Every object type that needs automatic naming must have an eService Object Generator object.

Every type that needs a unique numbering sequence requires an eService Number Generator object connected to the eService Object Generator. The Object and Number Generator business object types are governed by the eService Object Generator policy. The business objects are created in the eServiceAdministration vault (symbolic name vault_eServiceAdministration). For example, the automatic naming business objects for Decisions looks like this:

Usually, the app takes care of the creation process when creating one object should also create additional related objects. If you want to customize an object so that when you create it, the app creates a secondary object, you can do that. For example, you could customize the app so that a Document object is created every time a Decision object is created. In this case, the eService Object Generator for Documents must be connected to the eService Object Generator for Decisions using the eService Additional Object relationship. This configuration causes the numbering sequence to be the same. The first Decision created would be named "DEC-0000100" and the first Document would be named "Doc-0000100".

The primary type is the type whose Object Generator is connected directly to the Number Generator and is on the From end of the Additional Object relationship, Decision in the case described above. Types on the To end of the Additional Object relationship are additional types—Documents in the above example. To define how the additional object connects to the primary object, you must specify a value for the eService Connect Relation attribute for the eService Additional Object relationship.

Object Generator Program

The program that generates the automatic names is called eServicecommonObjectGenerator.tcl.

The program accepts the following parameters. These parameters are passed by the program that creates the object, which may be a Tcl program or a JavaServer Page (JSP).

Parameter Description
ObjectGeneratorName Name of the eService Object Generator that contains the attributes for the object type. For example, if the object generator is for ECRs the object generator name would be "type_ECR".
ObjectGeneratorRevision Revision of the eService Object Generator.
CreateAdditional Specifies whether to create additional objects. This is a flag with the values Null and Additional. Null means no additional objects are to be created. Default is Null.
ObjectVault The vault in which to create the object; default is the context vault.
CustomRevisionLevel Specifies a custom revision for the new object. Default is Null, no custom revision.

The program returns a list of lists. Each item in the list holds the ID, type, name, and revision of the object created. If there is an error, it returns a list with the first item as null and the second item contains the error message.

How Automatic Naming Works

When a user performs a task that calls for an object to be created using the automatic naming process, the eServicecommonObjectGenerator.tcl program performs these steps:

  1. Makes sure the eService Object Generator object for the object type exists. If the object does not exist, the program returns with a null and an error message.
  2. Gets the attribute values for the eService Object Generator for the type.
  3. Locks the Number Generator object for the object type to avoid creating objects with the same name when more than one user attempts to create a object at the same time. If the object is already locked, the program waits for the time period set for the eService Retry Delay attribute. The program retries for eService Retry Count times. If the program is unable to access the Number Generator, it returns with a null and an error message.
  4. After locking the Number Generator object, gets the next number to be generated from the eService Next Number attribute on the eService Number Generator object for the object type.
  5. Updates the Next Number attribute with the next value to be assigned: the current value of the attribute + 1.
  6. Unlocks the Number Generator so it is now accessible when another user needs to create an object.
  7. Generates the name of the object to be created as PrefixNextNumberSuffix.
  8. Makes sure the name is unique. If the object is unique, the program creates the object. If the name is not unique, the program tries to get a unique number until it gets one or until the eService Processing Time Limit (an attribute on the Object Generator) gets exhausted, whichever comes first. If the eService Processing Time Limit gets exhausted, then the program returns with a null and an error message saying that the Number Generator object is busy.
  9. Determines if there are additional objects to be created using the value of the input parameter CreateAdditional. If no additional objects are to be created, the process is complete.
  10. If additional objects are to be created, the program expands on the primary object for the relationship eService Additional Object and gets all the additional objects to be created. For each of these additional objects, the program makes sure the name is unique. If a name already exists, the program tries to get a new number.
  11. The program connects the newly-created primary object with the newly-created additional object(s). The values of the attribute eService Connect Relation defines the relationships to use for connecting the objects. The program assumes the From type of the relationship is always the primary object.

Calling the Object Generator from a JSP

To use the object generator in a JSP program, you can use one of the autoName functions provided in the FrameworkUtil class.

See the API documentation for details about the available autoName methods.

Calling the Object Generator from Tcl

To use the object generator within a Tcl program, call eServicecommonObjectGenerator.tcl using utLoad. Pass the ObjectGeneratorName, ObjectGeneratorRevision, ObjectPolicy, and CreateAdditional (optional) parameters to the eServiceNumberGenerator procedure.

Remember to register the symbolic name for any custom administrative objects (objects that are not supplied with Collaboration and Approvals). If you use an unregistered symbolic name as an input for a program, the program will not work. See Registering Your Own Administrative Objects.

The following example shows how a Tcl program would use the object generator to create objects of type XYZ, revision 1, and policy ABC.

tcl;
eval [utLoad eServicecommonObjectGenerator.tcl] 
set sNewInfo [eServiceNumberGenerator "type_XYZ" "1" "policy_ABC" ""] 
set sNewInfoErrorFlag [lindex $sNewInfo 0]
if {[string compare $sNewInfoErrorFlag ""] == 0 } {
set mqlret 1
set outstr [lindex $sNewInfo 1]
} else {
set sNewObjectId [string trim [lindex [lindex $sNewInfo 0] 0]]
set sNewType [string trim [lindex [lindex $sNewInfo 0] 1]]
set sNewName [string trim [lindex [lindex $sNewInfo 0] 2]]
set sNewRev [string trim [lindex [lindex $sNewInfo 0] 3]]
}