Hi, to continue with Juris's assessment, a script runs within a context, for example as the result of an event from an MBO or perhaps a cron or integration. When the context is created, there will be a reference to the event trigger which is particularly useful if the event was an MBO because there will be a reference to that MBO (and all the related MBOs) within the new script object.
The error shown suggests there isn't a reference to the object your looking at, so the question to answer is what objects are in the current context. There are several tricks I use to understand what is available within the context. I have a development snippet I use that simply logs (rather than prints) the current MBO and the type of trigger that created the current script context. I also use 'dir' to expose information about the methods available within the current invocation. Note that the difference between print and log is that print statements execute at the end of the script execution, whereas log statements execute immediately (essentially).
One more thing to beware of init scripts. Because of the timing in the creation of the MBO in an init script, some pieces of the MBO that might appear in the fully constructed MBO might not be built when the init executes. There is also the possibility that a script may fail here without any overt indication in the logs (other than the script does proceed past a certain point)
------------------------------
keith simmons
------------------------------
Original Message:
Sent: Thu October 20, 2022 03:32 AM
From: MAX092012
Subject: Populate a required primary column field using automation script in Maximo
Hi,
I'm trying to populate a value in PLUSDMETERGROUP.SAMPLINGGROUP attribute using an automation script based on the values populated in some other fields in a particular format however the set value does not seem to work as expected.
Hence, I tried to set a hardcoded value on this field something like "TEST123" however even this did not work and resulted in the same error. I could not gather much information in the logs however I'm not sure if we can set a value on an attribute which is a primary column and required at database level using automation script.
Object launch point - PLUSDMETERGROUP - Before save /after save
mbo.setValue("SAMPLINGGROUP", "TEST123",11L)
Error - BMXAA7837E - An error occurred that prevented the CXTEST script for the CXTEST launch point from running.
java.lang.NullPointerException: java.lang.NullPointerException in <script> at line number 1
------------------------------
MAX092012
------------------------------
#AssetandFacilitiesManagement
#Maximo