Route workflow from a table row
Hello;
Sometimes you need to start workflow of child records from the parent record… For example you have a problem record and there are 5 child activities. Normally you have to start workflow by going to the related record. With this piece of code you can start workflow from the Activities table of the parent problem record.
First create a ROUTEWF Button in the table. To do this drop a new tablecol to the table. And select Event as type. Select a route image. And enter ROUTEWF as event name.
Then change the bean class name to your class which you are creating now. (Be careful; I extended Problem activities table bean class here, you should extend whatever you need.)
Write your workflow name to the WFNAME in the code.
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 29 30 31 | package custom.beans.app.problem; import com.ibm.tsd.pmcom.webclient.beans.PmActivitiesBean; import psdi.app.workorder.WOActivityRemote; import psdi.server.MXServer; import psdi.webclient.system.controller.SessionContext; import psdi.workflow.WorkFlowServiceRemote; public class problemActivitiesBean extends PmActivitiesBean { public int ROUTEWF() { MXServer mxs; try { mxs = MXServer.getMXServer(); WorkFlowServiceRemote wsrmt = (WorkFlowServiceRemote)mxs.lookup("WORKFLOW"); WOActivityRemote mbo = (WOActivityRemote)getMbo(); wsrmt.initiateWorkflow("WFNAME", mbo); fireStructureChangedEvent(); refreshTable(); this.sessionContext.queueRefreshEvent(); } catch (Exception e) { e.printStackTrace(); } return 1; } } |
You’re good to go now;
Have a good day…
January 25th, 2010 at 8:51 pm
Burak, thanks so much for this tip. This will come in very handy!
February 23rd, 2010 at 6:34 pm
Hi Burak,
I would like to know if it is possible to initiate workflow from a Java class which extends psdi.iface.migexits.UserExit.
I followed your tip, but I don’t know why it didn’t work.
I’m trying to start a workflow after running a webservice (Maximo 7.1).
Any clue would be very appreciate.
Best Regards,
Rodrigo