Object launch point

This launch point enables you to run scripts for Maximo® business object (MBO) events, initialize and save point, add, update and delete. In addition to those events, this launch point also uses the pre-add or can add and pre-delete or can delete events that can control whether an MBO can be added or deleted. You can configure a launch point to listen to one or more of these events at the same time. The script has access to the event MBO by using the implicit variable mbo, the MboSet and all the related MBOs. To create scripts that use an object launch point, in the Automation Scripts application, click Create > Script with Object Launch Point.

Initialization event

The initialization-event-based scripts can be used to set calculated fields; set fields as read only, required, or hidden; or set conditional defaults to MBO attributes. The save-point-event-based scripts can be used to implement save-point object validations and save-point actions. The following example demonstrates an initialization-point script and the next example demonstrates a save-point script. Suppose you want to customize the Asset application to display the total spare part quantity in a new nonpersistent asset object attribute called sparepartqty. This action requires that whenever an asset MBO gets initialized, the sparepartqty displays the sum of all the spare part quantities that are associated with that asset. So, it is evident that it is an object launch point for the asset object and you must attach the script to the initialization event of the asset object. To do this, in the Automation Scripts application, click Create > Script with Object Launch Point. Next, create a launch point. Use the initialization event to start this script.

You need variables for this customization. First, there is a variable that is called sptqt that binds to the new asset MBO attribute sparepartqty. Set the value of this attribute. This variable is of type OUT. Next, get all the quantities from the related spare part MBOs of the asset. To do that, you use the array variable notation * to get an array of quantity values from the related spare part MboSet. Consider that the array variable is qtys and its bind value is asset_to_spare_part_relation_name.attribute_name* that is sparepart.quantity*. The asterisk at the end indicates the array nature of this variable and also instructs the framework to form the array by using the specified relationship.

Array variables are always of type IN and that works because you are not modifying the quantities, but you are merely summing them up. So, with these basic variables defined you now attempt to write the following script:
if qtys is not None:
  sptqt = sum(qtys)
It is a two-line script that validates whether spare part MBOs exist, and if they exist, sums them up and sets the value to the sptqt variable. The scripting framework picks that up and sets the value back to the binding of sptqt or sparepartqty. No Java™ coding is required because it is a Jython script. The sparepartqty should be always be read-only. The script is the best place to set it to read-only, which embodies the asset initialization event. The following script adds the code to set the sparepartqty attribute to read-only.
sptqt_readonly=True
if qtys is not None:
  sptqt = sum(qtys)

If there is a compilation error, you must stay on the last page until you cancel or fix the script.

The benefit of the implicit variable concept is that when you bound sptqt to the sparepartqty attribute, the scripting framework injected not only the variable sptqt at run time, but also some implicit variables like sptqt_readonly, sptqt_required and sptqt_hidden. Each of these variables is Boolean and relates to the read-only, required, and hidden flags of the MBO attribute.

Application validate event

Use this object launch point to do the validation routines for the full object. Compared to the attribute launch point validate event, which is geared toward individual attribute validations, this point offers the full MBO to validate. The implicit variables available at this script point are identical to the ones available for the save event, which is the before-save script point. You can use this point for validation compared to the before-save script point. Often application or framework code calls the MBO validate routine. In such cases, this script point is run and the before-save is not run. So, while the before-save is good to handle save point actions, validation should ideally be handled in this script point.

Save event

Save point validations help demonstrate more features of this framework.