Creating an Action Class
Hello;
Now I am going to tell about custom action classes…
These classes help us to add custom actions to workflows…
We must write these classes in the psdi.common.action package.. We extend ActionCustomClass and override applyCustomAction method to make maximo do what we want to do…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package psdi.common.action; import java.io.PrintStream; import java.rmi.RemoteException; import psdi.mbo.MboRemote; import psdi.server.MXServer; import psdi.util.MXApplicationYesNoCancelException; import psdi.util.*; import com.custom.workorder.*; public class newFlowAction implements ActionCustomClass { newFlowAction() { } public void applyCustomAction(MboRemote mboremote, Object aobj[]) throws MXException, RemoteException { com.custom.workorder.newWORemote mbo=(com.custom.workorder.newWORemote)mboremote; if(mbo.getString("STATUS").equalsIgnoreCase("INPRG")){ mbo.getMboSet("OTHEROBJECT").deleteAll(); } } } |
Here on line 23 we cast our mbo to custom Workorder object. Now we are able to use workorder’s methods on mbo object. On line 24 we check if the status is INPRG or not…
And on line 25 if the status is INPRG we select the OTHEROBJECT relationship and delete all mbo’s that came with OTHEROBJECT relationship…
Then we compile the code… Rebuild Maximo.ear.. Redeploy it… Now you can use it in the related workflow..
Have a good day…
Tags: java
March 16th, 2009 at 6:10 pm
Hi,
Have you done this successfully in Maximo 6? I have made a custom action class according to this and used it in an escalation – my escalation work, but the class does not get executed … I do not get any errors, it just does not do anything.
March 19th, 2009 at 7:54 am
Hello;
I made it work via creating a new action from Actions applications and give the classname with package name to the value field in action. Can you tell me more about your process..
Thanks…
April 15th, 2010 at 9:55 pm
Hello,
I created a custom class…but i have a little issue…
In the action class i create a Change record, this works fine, however when i get to the next node, which is an interaction node using the relation NEWCHANGE it send me an error saying that the change does not exist.
I can validate that the change is really in the database…seems like the workflow looses the reference on the mbo….any ideas how to solve this?
Thanks!