Akshay Patil
Newbie
Karma: 0
Posts: 4
|
 |
« on: March 15, 2011, 08:56:16 am » |
|
Hi,
How can I initiate workflows automatically right after generating new workorders? Any documentation or code templates will help?
Thanks, Akshay
|
|
|
|
|
Logged
|
|
|
|
|
Ethen
|
 |
« Reply #1 on: March 15, 2011, 12:05:52 pm » |
|
Set the workflow as auto initiate from select action.
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
Akshay Patil
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #2 on: March 15, 2011, 01:24:14 pm » |
|
Sorry for being so brief...
The problem Im facing is that I've written the custom code that generates the workorders successfully according to the given meter readings but I cannot find any documentation on how to put that generated workorder into workflow through code and not through Maximo application.
BTW , Im using Maximo 5.2
Thanks for the reply!!
|
|
|
|
|
Logged
|
|
|
|
|
Ethen
|
 |
« Reply #3 on: March 15, 2011, 07:15:01 pm » |
|
Oh.. Dont know about Maximo 5.2 but in Maximo 7 it can be initiated through coding.
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
|
Ethen
|
 |
« Reply #4 on: March 15, 2011, 07:20:28 pm » |
|
a code sample.. you might want to explore classed in 5.2
import psdi.workflow.WorkFlowServiceRemote; public class woext extends wo{
public int SAVE() { MXServer mxs; try { mxs = MXServer.getMXServer(); WorkFlowServiceRemote wsrmt = (WorkFlowServiceRemote)mxs.lookup("WORKFLOW"); WOActivityRemote mbo = (WOActivityRemote)getMbo(); wsrmt.initiateWorkflow("yourworkflow", mbo); } catch (Exception e) { e.printStackTrace(); } return 1; } }
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
Akshay Patil
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #5 on: March 16, 2011, 12:24:44 pm » |
|
Thanks for the code but it is not working along with its tried mofications . It cant seem to find WOActivityRemote class. I too tried searching it manually but cant find it . Moreover the program cant seem to find the overload for initiateworkflow that takes am MBO as an argument
wsrmt.initiateWorkflow("yourworkflow", mbo);
I am new to maximo ,maybe Im missing something.
Any documentations on initiating workflows in maximo 5.2?
Thanks for the help!!!!
|
|
|
|
|
Logged
|
|
|
|
|
Ethen
|
 |
« Reply #6 on: March 17, 2011, 07:08:08 pm » |
|
well the code sample was for maximo 7. you might want to explore some workflow classes in 5.2
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
|
maurogrz
|
 |
« Reply #7 on: March 18, 2011, 01:15:46 pm » |
|
Hi, I have an old v5.2 crontask class that start workflow of a new created workrder. the statement is simple:
newWorkorder.initiateWorkflow("automatic WO from backend");
where newWorkorder is my newly create WO and "automatic WO from backend" is the memo I wanto to set for this wokflow step.
regards, Mauro
|
|
|
|
|
Logged
|
|
|
|
|
Ethen
|
 |
« Reply #8 on: March 21, 2011, 12:11:49 pm » |
|
Hi, I have an old v5.2 crontask class that start workflow of a new created workrder. the statement is simple:
newWorkorder.initiateWorkflow("automatic WO from backend");
where newWorkorder is my newly create WO and "automatic WO from backend" is the memo I wanto to set for this wokflow step.
regards, Mauro
hope it solves the problem. But I have one ques. If workorder has more then 1 workorders in active status, how will program know which one to start. I dont see any arguements with regards to the workflow instances .
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
|
maurogrz
|
 |
« Reply #9 on: March 21, 2011, 01:31:10 pm » |
|
in v5.2 there was only one active workflow for specific object (WORKFLOW, SR, and so on)
in v7 I use another statement:
((WorkFlowServiceRemote)MXServer.getMXServer().lookup("WORKFLOW")).initiateWorkflow("MYWORKFLOWPROCESS", newWorkorder);
...where MYWORKFLOWPROCESS is the name of the workflow I want to start.
|
|
|
|
|
Logged
|
|
|
|
Akshay Patil
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #10 on: March 22, 2011, 11:18:23 am » |
|
Hi,
The statement
newWorkorder.initiateWorkflow("automatic WO from backend");
Initiates workflow of the newly created workorders only and this method is only available if the class is inherited from WFMbo. Currently Im generating orkorders using MEASUREPOINT Mbo which has a different inheritance heirarchy.
measurepointremote.generateWorkOrder(measureDate,"Generated by CM Cron Task",true);
Typecasting is creating problems and also I tried to introduce WFMbo in the inheritance heirarchy but in vain.
|
|
|
|
|
Logged
|
|
|
|
|
Ethen
|
 |
« Reply #11 on: March 22, 2011, 12:06:07 pm » |
|
why dont you extend both d classes and create a custom method which initiates the workflow. and call it from the other class.
|
|
|
|
|
Logged
|
regards,
Ethen...
|
|
|
|
maurogrz
|
 |
« Reply #12 on: March 22, 2011, 03:19:45 pm » |
|
....or a piece of code that search for the newly created WO and start workflow
|
|
|
|
|
Logged
|
|
|
|
|