Warning framework for automation scripts

The warning framework helps you identify whether the automation script might result in an unexpected output or adversely affect system performance.

The warning framework checks the automation script based on the regular expressions, validators, or both. The description of each warning code contains a recommendation that you can use to improve your automation script. You can mark a warning as resolved after implementing the recommendation in your automation script.
Note: Recommendations are based on the scripting recommendations for Maximo® Manage. Not all recommendations might be implemented by using this framework, so the absence of warnings does not imply that the script is perfect.

In the Automation Scripts application, on the Automation Scripts tab, the Has Warning field is set to on for any automation script that has unresolved warning. The Has Warning field is nonpersistent and cannot be used for filtering scripts. You can view more details on the Warnings tab.

The following table lists the warning codes that are covered in the warning framework.

Table 1. Warning codes for automation scripts
Warning Code Description Checked Regular Expression Checked Validator
BMXAA10015W Avoid an explicit save on the object. The Maximo transaction framework saves the object if it is modified. \save\( com.ibm.tivoli.maximo.script.ScriptSaveWarningValidator
BMXAA10018W Avoid using the Mozilla compatibility for performance reasons. load.nashorn:mozilla_compat.js.  
BMXAA10019W Object Initialization are always called when objects are initialized. Consider changing this object initialization to an attribute initialization launch point to use just-in-time initialization.   com.ibm.tivoli.maximo.script.ScriptObjectInitWarningValidator
BMXAA10022W The system detected one of more scripts that have the same launch point. The scripts will run in an arbitrary order. Any logic depending on a fixed order will fail.   com.ibm.tivoli.maximo.script.ScriptLPConflictWarningValidator
BMXAA10023W Use service.log(..) instead of print for logging so that the script uses the real-time logging in the Maximo logging framework. print\(  
BMXAA10024W Use service.log(..) for logging instead of printso that the script uses the Maximo logging framework and is in real time. print  
BMXAA10025W Use service.error(..) instead of errorkey and errorgroup. The use of service.error(..) throws MXException in real time. errorkey=  
BMXAA10026W The use of mboset.count(..) is costly because it contacts the database every time it is invoked. Do not use it inside the loop body. Consider using another option, such as mboset.moveFirst()/mboset.moveNext() to iterate through the MboSet. count\(  
BMXAA10027W MXServer and all Maximo Application services are pre-instantiated objects. Access the pre-created instance and do not attempt to create your own. MXServer\(\  
BMXAA10028W Every root mboSet that is created by a script needs to have a matching mboset.cleanup() call to release the resources that are held by the mboset.   com.ibm.tivoli.maximo.script.ScriptMboSetCleanupWarningValidator

The warning framework uses the scriptwarn cron task instance. You can change the schedule and status of this cron task in the Cron Task Setup application. For more information, see Changing cron task instances.