Alfresco · Starting workflow from Java

private static final String GROUP_NAME = "REVIEW_GROUP";
private static final String WORKFLOW_DESCRIPTION = "Request for approval";
private static final String TASK_DESCRIPTION = "Check contents and review.";
private static final String ACTIVITI_PARALLEL_GROUP_REVIEW_NAME = "activiti$activitiParallelGroupReview";

protected void startWorkflow(NodeRef contentNodeRef, ServiceRegistry serviceRegistry) {

	// Required repo services should be injected by using Spring beans
	AuthorityService authorityService = serviceRegistry.getAuthorityService();
	NodeService nodeService = serviceRegistry.getNodeService();
	WorkflowService workflowService = serviceRegistry.getWorkflowService();
	NodeRef workflowNodeRef = workflowService.createPackage(null);
	// Set WF properties: don't forget to start group short name with 'GROUP_'
	Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
	parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowNodeRef);
	parameters.put(WorkflowModel.PROP_DESCRIPTION, TASK_DESCRIPTION);
            authorityService.getAuthorityNodeRef("GROUP_" + GROUP_NAME));
	parameters.put(WorkflowModel.PROP_PERCENT_COMPLETE, 50);
	// Add zero or more items
                    contentNodeRef, ContentModel.PROP_NAME).toString())));
	// Start workflow
	WorkflowDefinition wfDefinition = 
	workflowService.startWorkflow(wfDefinition.getId(), parameters);


… is the same as …

Alfresco start workflow


4 comentarios en “Alfresco · Starting workflow from Java

  1. I followed the same as above but for group it is getting exception that please select reviewer group I doing for custom workflow let you share what wrote
    private static final String reviewer = “GROUP_REVIEWERS”;
    private static final String approver = “GROUP_APPROVERS”;

    WorkflowDefinition workflow = workflowService.getDefinitionByName(workflowName);

    // Set the workflow package
    // this contains the files within the workflow
    NodeRef workflowPackage = workflowService.createPackage(null);
    ChildAssociationRef childAssoc;

    childAssoc = nodeService.getPrimaryParent(nodeRef);
    nodeService.addChild(workflowPackage, nodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName());

    //Workflow parameters
    Map parameters = new HashMap();
    parameters.put(AMYSModel.ASSOC_GROUP_REVIEWERS, authorityService.getAuthorityNodeRef(“GROUP_”+reviewer));
    parameters.put(AMYSModel.ASSOC_GROUP_APROVERS, authorityService.getAuthorityNodeRef(“GROUP_”+approver));
    //parameters.put(“{}dcc”, “DCC”);
    parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION,”Document is gng to expire so again starting workflow”);
    parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);

    WorkflowPath workflowPath = workflowService.startWorkflow(workflow.getId(), parameters);

    Exception from executeScript – redirecting to status template error: 08300019 Failed to execute supplied script: 08300018 Please select reviewer and approvers ! from my logs


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s