Adding scripts that run as asynchronous jobs

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

  1. In the Automation Scripts application, add a script to run the asynchronous job.
    The implicit variables where, mboname, and userInfo are available.
  2. Specify other information as needed.
  3. 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();
  4. 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.