Script with an object launch point

An object launch point associates a script with a business object and executes in response to a business object event. Events are associated with a specific context so that the script executes before or after the object is saved or after it is committed to the database. You can, optionally, associate an event with a condition and limit execution to circumstances where the condition is satisfied.

An object launch point can be based on any object in the database, and you must associate it with one of the following events:

Initialize value
Indicates whether the script is executed by the initialize event.
Validate application
Indicates whether the script is executed by the validate event.
Allow object creation
Indicates whether new Maximo® business objects can be created. For example, your business logic can state that when a purchase order is approved, new POLINE objects cannot be created. Only one launch point can be defined for the selected Maximo business object and the Allow object creation event.
Allow object deletion
Indicates whether Maximo business objects can be deleted. For example, your business logic can state that when a work order is approved, WOLINE objects cannot be deleted. Only one launch point can be defined for the selected Maximo business object and the allow object deletion event.
Save
Indicates whether the script is executed by the save event. If you select the Save radio button, you must specify the context for the save in the Save section.
The save event can be executed in any of the following contexts:
Before save
The script is executed and sets values on the business object before the underlying transaction is saved. For example, you can apply a business rule that checks if a specific naming convention has been followed when a new record is being saved. If the naming convention rule has not been followed, the save activity is not allowed and the user receives an error message.
After save
The script is executed after the business object is saved to the database but before the changes are committed. This event context enables you to incorporate a business rule and roll back processing on a transaction if necessary. For example, in an integration scenario, if a transaction update to an external system fails due to a connection issue, the initial transaction can be rolled back so that both databases remain synchronized.
After commit
The script is executed after a transaction has been committed to the database and cannot be rolled back. This event context is typically used to initiate additional actions immediately after the commit of a particular business object. For example, a script initiates sending email notifications when a work order is completed or sends an integration message to notify an external system when a purchase order is created.

In the Object Event Condition field, you can restrict activation of the script by specifying a condition that is related to the event. For example, to redirect a user to a new form when a user attempts to add a person whose language is not English. In this scenario, if the langcode attribute for the person is set to English, the script is not activated.

Example of an object launch point

When an asset record is created, the asset number must adhere to a naming convention. The asset number must be prefixed with the type of asset that the user is creating. For example, a Facilities asset must have an FT prefix. If the appropriate prefix is not specified, show an error message to indicate that the prefix is invalid.
To implement the requirement, complete the following steps:
  1. Define an object launch point on the ASSET business object.
  2. Define the script that associates the prefix and associate the script with the object launch point:
    def setError(prefix):
        global errorkey,errorgroup,params
        errorkey='invalidassetprefix'
        errorgroup='asset'
        params=[prefix,assettype]
    
    if assettype_internal=='FACILITIES' and not assetnum.startswith('FT'):
        setError('FT')
    elif assettype_internal=='FLEET' and not assetnum.startswith('FL'):
        setError('FL')
    elif assettype_internal=='IT' and not assetnum.startswith('IT'):
        setError('IT')
    elif assettype_internal=='PRODUCTION' and not assetnum.startswith('PR'):
        setError('PR')
  3. Test the object launch point and script, and activate or de-activate the launch point as required.


Feedback