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>);
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:
i want to initiate workflow for the incident.
please help me how do i apply this code to my envoirment
Post a Comment