Pages

Tuesday, April 14, 2020

Automation Script Implicit Variables Explained

There are certain variables provided by the framework. These variables are not necessary to be declared before using. Some of these variables are valid only for specific launch point or a particular event. For example: user is valid for all the launch point where as mboset is valid only for Object launch point allow object creation event.

There are two types of implicit variables. Those which are not associated with any other variables and are used directly in the script and those which has to be associated with the variables. Lets get into the details.


i. Implicit variables which are not associated with any other variables.

mbo

 
Type: psdi.mbo.Mbo
Launch point: All Launch Point
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: mbo refers to the Mbo that is being worked on.
Exception: mbo does not work with an object launch point for a non-persistent object.
Type: psdi.mbo.MboSet
Launch point: Object Launch point
Event: Allow Object Creation / Allow Object Deletion
Script: Scripts associated with launch point/event mentioned above.
Details: mboset refers to MboSet to which the Mbo will be added to. We can also get the set by using mbo.getThisMboSet()
Example: If we create a launch point for PRLINE on Object Creation, when adding a new line in the PR, mboset will get the MboSet for that PR only.
Type:  String
Launch Point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: mboname indicates the name of the current Mbo that is being worked on. We can also get the name by using mbo.getName(). This will be useful when we are writing multiple launch points with the same script. 
Type:  psdi.mbo.MboValue
Launch Point: Attribute Launch Point
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details:  mbovalue  indicates the instance of the Mbo Attribute for the attribute launch point. 
Example: If the Launch point is on an attribute of type ALN then the type of mbovalue will be psdi.mbo.MboALNValue, similarly if the attribute is DATETIME then mbovalue will be psdi.mbo.MboDATETIMEValue.

app


Type:  String
Launch Point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: app indicates the name of the application the script is running against.
Condition: app only works if the object of the launch point is the main object of the application. If the launch point object is a child of main object, app will return null value.
Alternative: To get the app name you have the get the main object of the application and use the getApp() on the mbo as mbo.getApp().
Example: If the launch point is on WOACTIVITY then you need to use mbo.getOwner().getApp(). Here getOwner method on the mbo will return the WORKORDER object and getApp on the WORKORDER will return WOTRACK if the application is Work Order Tracking. If getApp() is used on WOACTIVITY in the WOTRACK Application it will return null value.
Type:  Mbo Attribute for attribute launch point
Launch Point: Attribute Launch Point
Event: init value and init access restriction
Script: Scripts associated with launch point/event mentioned above.
Details: thisvalue represents current attribute in the Launch Point. Used to set the value in the init value event and can be used together with explicit variables for use access restriction such as hidden, read-only, required
Type: String
Launch point: All Launch Point
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: user refers to the user id who is logged in. We can get the value for the user logged in but cannot modify the value.
Type: psdi.security.UserInfo
Launch point: All Launch Point
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: userinfo provides the UserInfo object for the current context.
Example: You may use this variable to get the person information etc.
Alternative: To get the UserInfo you may use mbo.getUserInfo().
Type: Boolean
Launch point: All Launch Point
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: interactive indicates whether is script is running in an active user session or a background session such as integration, cron task etc.
Type: Boolean
Launch point: Custom Condition Launch Point
Event: NA
Script: Scripts associated with launch point/event mentioned above.
Details: Set the value of evalresult to True or False. Condition script will return this value when executed. 
Example: Once you create a custom condition launch point you can create a condition in condition expression manager. This condition can be used in many places in Maximo such as Conditional UI properties in Application designer, Workflows, Domain conditions etc. 

Type: String
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: launchPoint indicates the name of the launch point in which the script is run.

Type: String
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above. This can also be used in script for Cron Task.
Details: scriptName indicates the name of the script that is running.

Type: String
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: errorgroup defines the message group defined in the database configuration application. Together with errorkey variable it identifies the message that has to be displayed. You can also use the implicit variable params if the message requires and parameters to be passed.
Alternative: service.error() can be used instead of errorgroup and errorkey variable to display error message. 

Type: String
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: errorkey defines the message key defined in the database configuration application. Together with errorgroup variable it identifies the message that has to be displayed. You can also use the implicit variable params if the message requires and parameters to be passed.
Alternative:  service.error() can be used instead of errorgroup and errorkey variable to display error message.

Type: String[]
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details: params holds the parameters to be applied for the message that is posted in the script. params is used together with the errorgroup and errorkey to prepare the error message that is posted in the script. params is a string array and is set in the script.  
Alternative: service.error(<message_group>,<message_key>,<parameter_array>) can be instead of errorgroup, errorkey and params.

Type: com.ibm.tivoli.maximo.script.ScriptService
Launch point: All Launch Points
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details:  Added to the script by the framework during run-time.

Type: String
Launch point: Action Launch Point
Event: NA
Script: Scripts associated with launch point/event mentioned above.
Details:  action indicates name of the action that is calling the script.

Type: psdi.mbo.Mbo
Launch point: Action Launch Point
Event: NA
Script: Scripts associated with launch point/event mentioned above.
Details: References the Mbo that is worked on. Preference is to use mbo in the script instead of scriptHome

Type: Boolean
Launch point: All Launch Points (Ideally used in Object launch point where the script applied to multiple events such as add, update, delete)
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details:  onadd indicates whether the script is running against the Mbo that is to be added. onadd can be used to perform conditional validation or action that is based on the state of Mbo.
Alternative: mbo.toBeAdded() can be used instead of onadd. Preference is to use onadd.

Type: Boolean
Launch point: All Launch Points (Ideally used in Object launch point where the script applied to multiple events such as add, update, delete)
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details:  onupdate indicates whether the script is running against the Mbo that is being updated. onudpate can be used to perform conditional validation or action that is based on the state of Mbo.
Alternative: mbo.toBeUpdated() can be used instead of onupdate. Preference is to use onupdate.

Type: Boolean
Launch point: All Launch Points (Ideally used in Object launch point where the script applied to multiple events such as add, update, delete)
Event: All
Script: Scripts associated with launch point/event mentioned above.
Details:  ondelete indicates whether the script is running against the Mbo that is being deleted. ondelete can be used to perform conditional validation or action that is based on the state of Mbo.
Alternative: mbo.toBeDeleted() can be used instead of ondelete. Preference is to use ondelete.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  domainid specifies the domain that is used to provide the list of values to be shown for the attribute.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  listWhere specifies the where filter that is set before the result are shown.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  Set to any ORDER BY attribute names that are used to order the results of the retrieve list event.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  listErrorGroup identifies message group created in the database configuration application. The error will be displayed when the retrieve list event fails. listErrorGroup should be used together with listErrorKey.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  listErrorKey identifies message key created in the database configuration application. The error will be displayed when the retrieve list event fails. listErrorKey should be used together with listErrorGroup.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  relationObject refers to the Mbo that is being searched from the current Mbo. Typically used together with srcKeys and targetKeys implicit variables.

Type: String
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  relationWhere is the where clause applied to the Mbo that is being searched from the current Mbo to perform retrieve list event. Typically used together with srcKeys and targetKeys implicit variables.

Type: String[]
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  Applies to the set of attribute names from the current MBO that is used to lookup a related record in another related or target MBO. For example, the set of attribute names from the current MBO might be used to look up that FAILURECODES field from the ASSET business object.

Type: String[]
Launch point: Attribute Launch Point
Event: Retrieve List
Script: Scripts associated with launch point/event mentioned above.
Details:  Applies to the set of attribute names in the target MBO that is looked up from the current MBO on which the attribute launch point is defined.
Type: psdi.workflow.WFInstance
Launch point: Action Launch Point
Event: Action started from a workflow
Script: Scripts associated with launch point/event mentioned above.
Details:  wfinstance indicates the workflow instance from which the current action was started.

Type: String
Launch point: NA
Event: NA
Script: Scripts that are running as Cron Task.
Details:  qName returns the name of the Cron Task Instance that is running the script.

Type: String
Launch point: NA
Event: NA
Script: Scripts that are running as Cron Task.
Details:  runAsUserInfo returns the psdi.security.UserInfo java object. You can use this variable to get additional information about the user that is associated with the Cron Task Instance.

No comments:

Post a Comment