Init and init value attribute events

The init attribute event helps set the metadata for the attribute, and the init value event initializes the value. You can also do this using the object init event but that can affect performance. These attribute events use the Maximo frameworks for just-in-time initialization. The scripts are called only if the framework needs to access that attribute. An object init event initializes the attribute whether it is needed or not.

The following sample script is used to initialize the priority attribute:
if mbo.toBeAdded()==True and mbo.getString("site")=="BEDFORD":
  thisvalue = 1
Note: The implicit variable thisvalue represents the attribute for this launch point.
Similarly, the init event provides implicit variables for setting the required, read-only, and hidden flags.
Table 1. Implicit variables for the init event
Variable name Variable type Purpose
thisvalue_required OUT Sets the attribute to be required or not
thisvalue_readonly OUT Sets the attribute to be readonly or not
thisvalue_hidden OUT Sets the attribute to be hidden or not
The following sample script is for this event:
if mbo.toBeAdded()==True and mbo.getString("site")=="BEDFORD": 
   thisvalue_required = True

You can set flags to the attribute for this launch point conditionally and the framework uses these flags only when it is being referred to.

Setting Maximo lookups

The retrieve list event for the attribute launch point, getList, provides a list of MBOs. This feature enables you to conditionally set the lookup name by using scripting in the attribute init value event. This feature is used in the retrieve list event when you click a lookup icon in the user interface.
The lookupname is the implicit variable where the script sets the lookup name from the lookup XML library. The lookup feature is used in applications that are not Graphite-based. The following code sets two known lookup names as a sample to show how to set the lookups dynamically.
if mbo.isNull("assettype"):
 lookupname="numericdomain"
else:
 lookupname="alndomain"
The script needs to back this up at the retrieve list launchpoint. A sample is shown in the following script.
if mbo.isNull("assettype"):
 domainid="ASSETP"
else:
 domainid="ASSETP2"