Tuesday 4 October 2011

How to Initiate Work Flow in maximo 7 through coding?

Step 1: import psdi.server.MXServer;
            import psdi.workflow.WorkFlowServiceRemote;
Step 2: Now write the below code in your method:

            try
             {
                  MXServer mx = MXServer.getMXServer();
                  WorkFlowServiceRemote wfsr = (WorkFlowServiceRemote)mx.lookup("WORKFLOW");

                   RFQRemote  rfq = (RFQRemote)getMbo();
                   wfsr.initiateWorkFlow("<work flow name>",rfq);
              }
              catch(Exception e)
             {
                  e.printStactTrace();
              }

Note: i) In the above sample code, I was initiated work flow of RFQ. So I used RFQRemote. Like that you can use your required application remote class. For example: If you want to initiate PO work flow, then you have to PORemote instead of RFQRemote.
          ii) initiateWorkFlow("<here you have to give WF name which you want to initiate>", <here you have to give MBO name, in the above example "rfq" is the instance of RFQRemote which is storing mbo of RFQ>);

1 comment:

Swaraj Gaur said...

i want to initiate workflow for the incident.
please help me how do i apply this code to my envoirment

Maximo SOAPUI error javax.xml.ws.WebServiceException

SOAPUI error while sending payload to below url (in cluster environment) http://localhost:9080/meaweb/services/MXASSET Error : <f...