You can add scripts that can run as asynchronous jobs in the product. Use the
asynchronous job framework to submit jobs that need to be run one time asynchronously, such as when
you want to run something quickly in the background.
Procedure
-
In the Automation Scripts application, add a script to run the asynchronous job.
The implicit variables where, mboname, and
userInfo are available.
- Specify other information as needed.
- Register the script in the MAXASYNCJOB table by specifying the nonpersistent Maximo® business object (MBO), as shown in
the following code sample.
The MBO name is ASYNCSCRIPT and is the object that the job
acts on. The job name is set by the script to be the same as the script name. The job name is used
by the ScriptAsynchJobHandler and is registered with the new entry in the MAXASYNCJOB table to run
the
script.
MboSetRemote msr = get mboset for ASYNCSCRIPT
((psdi.mbo.NonPersistentMboSet)msr).setup();
MboRemote mbo = msr.moveFirst();
mbo.setValue("autoscript", "TESTASYNC");
mbo.setValue("objectname", "PO");
((psdi.mbo.NonPersistentMboSet)msr).execute();
- Activate the script.
The scripted job is registered and is run one time
by the asynchronous job framework.
Example
For example, you can specify the job to fetch an MboSet by using the
userInfo variable and the name of the MBO. Apply the WHERE clause and process
the job for each MBO.