cancel
Showing results for 
Search instead for 
Did you mean: 

MDM java api's

Former Member
0 Kudos

Hi,

i am working on MDM java api's . when i am working with workflows i can able retrieve the workflows and creating the job . but i am unable to launch the workflow through JAVA API'S.Is it possible through Java api's. please help me in this concern.

Accepted Solutions (1)

Accepted Solutions (1)

former_member201266
Contributor
0 Kudos

Hi Ratna,

Check n use the following code, might be usefull....

LaunchWorkflowJobCommand LWJC = new LaunchWorkflowJobCommand(connections);

LWJC.setSession(session);

WorkflowJobId WJID = new WorkflowJobId(<Check job id in ur work flow and insert here>);

LWJC.setJobId(WJID);

try

{

LWJC.execute();

}

catch (CommandException e)

{

e.printStackTrace();

return;

}

Cheers,

Cherry.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Deepthi,

I had used the below code for retrieving the workflow's id's

RetrieveWorkflowsCommand RetriveworksFlows = new RetrieveWorkflowsCommand(connections);

RetriveworksFlows.setSession(session);

try{

RetriveworksFlows.execute();

}

catch(Exception e)

{

}

WorkflowProperties[] workflowpro = RetriveworksFlows.getWorkflows();

WorkflowId[] workflowid = new WorkflowId[workflowpro.length];

for(int n=0;n<workflowpro.length;n++)

{

workflowid[n] = workflowpro[n].getId();

String workfloName = workflowpro[n].getLaunchType()+"";

System.out.println("id--"workflowid"name"+workfloName);

}

-


and for creating the workflow job id i had written the below code

CreateWorkflowJobCommand workflowjobcommand = new CreateWorkflowJobCommand(connections);

workflowjobcommand.setWorkflowId(workflowid[0]);

workflowjobcommand.setRecordIds(recordId);

workflowjobcommand.setSession(session);

try{

workflowjobcommand.execute();

}

catch(Exception e)

{

}

-


then to start the workflow what i have to do .

please expain me

DeeptiChavare
Active Participant
0 Kudos

Hi Ratna kumar,

You can use following steps:

1. Create an object of type InactiveWorkflowTask.

Eg.

InactiveWorkflowTask workflowTask= new  InactiveWorkflowTask(workflowJob, WorkflowTask.Status.UNLAUNCHED, username);

2. Get WorkflowTaskAction using RetrieveWorkflowTaskActionsCommand. Use setWorkflowTask() to set workflow task.

On execution, this command returns array of workflowtaskaction.

You can iterate through this array (or use for loop) and find an workflowtaskaction having type = WorkflowTaskAction.LAUNCH

3. Select this workflowtaskaction and use ExecuteWorkflowTaskActionCommand to trigger workflow.

Hope this helps.

Regards,

Deepti

Former Member
0 Kudos

hi Deepthi ,

when we are creating the inactiveWorkflowTask objucet how we ahve to give the workflow job,workflow.status

upto now i can able to retrieve workflow id's and creating the job only

if you are having any code once send me .