Start workflow from external application
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2011 04:13 AM
Hello, I would like to start a workflow from an external application using web service. I know that workflow service are not exposed as soap, so I am trying to call the start-workflow action (org.alfresco.repo.workflow.StartWorkflowActionExecuter).
I have the following problems:
Alessandro
I have the following problems:
- That action defines only 3 parameters (workflowName, endStartTask, startTaskTransition). How can I specify other properties such as assignee, due date, priority, description)?
- ActionUtils.executeAction requires parameters as HashMap<String, String>. If the above action allows to specify undefined parameters too, how can I specify values other than strings like nodeRef (assignee) or date?
Alessandro
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2011 10:50 PM
Someone please answer the OP. I'm having this same problem…

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2011 02:49 AM
Solved. I created a new action. Basically is the same code of org.alfresco.repo.workflow.StartWorkflowActionExecuter. The new action converts string parameters to the proper types (date, person, int, …)

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2011 04:05 AM
Why you did not use "start-workflow"?
Why you had to convert the parameters?
Look for "org.alfresco.webservice.util.ActionUtils". This class contains this methods:
public static String executeAction(Reference ref, String actionName, Map<String, String> parameters)
:?:
Why you had to convert the parameters?
Map<String, String> param = new HashMap<String, String>();param.put("bpm:workflowDescription", "Something");// etc etcReference reference = new Reference(store, null, null);ActionUtils.executeAction(reference, "start-workflow", param);
Look for "org.alfresco.webservice.util.ActionUtils". This class contains this methods:
public static String executeAction(Reference ref, String actionName, Map<String, String> parameters)
:?:
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2011 04:26 AM
Compared to "start-workflow" my action allows to specify the workflow initiator (rather then the user credentials used to authenticate against the external application) and other custom fields.
One of these custom fields is a person (like the assignee). So I can provide the username as a string parameter from the external application using the ActionUtils.executeAction method. Then this value is used to retrieve the correct information and object type:
One of these custom fields is a person (like the assignee). So I can provide the username as a string parameter from the external application using the ActionUtils.executeAction method. Then this value is used to retrieve the correct information and object type:
for (Map.Entry<String, Serializable> entry : paramValues.entrySet()) { String key = entry.getKey(); QName qname = QName.createQName(entry.getKey(), namespaceService); if (key.equals("dnetwf:checker")) { value = personService.getPerson((String)entry.getValue()); workflowParameters.put(qname, value); }}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2011 04:38 AM
One of these custom fields is a person (like the assignee). So I can provide the username as a string parameter from the external application using the ActionUtils.executeAction method.Now I understand that.

If I use "start-workflow" and I run the code does not start the new workflow. :cry:
But I do not give up!
