cancel
Showing results for 
Search instead for 
Did you mean: 

java API for triggering workflow

Former Member
0 Kudos

Hi All

I am new to MDM and webdynpro java. I have a requirement where I need to trigger a workflow using a button.

could anyone send me the code for how to trigger workflows of MDM using the java APIs.

Thanks in advance

Regards

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Prashant

I tried to use the code which you gave in the previous post to trigger a workflow. but I get error saying the "classs cannot be resolved" could you please let me know the .jar file that I need to use to get this class.

Regards

Former Member
0 Kudos

Hi Sudheendra,

You need MDM Java 2 API SP 5 or above for this. You can obtain the latest JAR files from service.sap.com.

Regards,

Arafat

Former Member
0 Kudos

Hi prashant

Kindly post the code to get the workflow id aswell.

Regards

Former Member
0 Kudos

Dear Prashant,

Thanks for the detailed code on how to execute a MDM Workflow using Java APIs.

If you could also post the code to get Workflow ID, it would be greatly appreciated.

Regards

Siva K.

Former Member
0 Kudos

Hi,

Create the connection using the simplefactory or ConnectionPoolFactory

Create the user Session with the repository.

The following code should work for triggering a workflow when the workflowID is known.

If u dont know the workflowID, then let me know, I shall post the code.


CreateWorkflowJobCommand objCreateWorkflowJobCommand = new CreateWorkflowJobCommand(objConnection.getConnectionAccessor());
		objCreateWorkflowJobCommand.setSession(objConnection.getUserSessionID());
		objCreateWorkflowJobCommand.setRecordIds(new RecordId[]{new RecordId(strRecordID)});
		objCreateWorkflowJobCommand.setWorkflowId(objWorkFlowID);
		try 
		{
			objCreateWorkflowJobCommand.execute();
		} 
		catch (CommandException e1) 
		{
			// TODO Auto-generated catch block
			e1.printStackTrace();
			throw e1;
		}

Best Regards,

-Prashant