I using the following script to trigger workflow using Rule on a folder :
[javascript]function startWorkflow(assigneeGroup)
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiSequencialReview";
workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
workflow.parameters["bpm:groupAssignee"] = assigneeGroup;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
return workflow.execute(document);
}
function main()
{
var name = document.name;
var siteName = document.siteShortName;
if (siteName == null)
{
if (logger.isLoggingEnabled())
logger.log("Did not start workflow as the document named " + name + " is not located within a site.");
return;
}
var reviewGroup = "GROUP_site_" + siteName;
// make sure the group exists
var group = people.getGroup(reviewGroup);
if (group != null)
{
if (logger.isLoggingEnabled())
logger.log("Starting pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
startWorkflow(group);
if (logger.isLoggingEnabled())
logger.log("Started pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
}
else if (logger.isLoggingEnabled())
{
logger.log("Did not start workflow as the group " + reviewGroup + " could not be found.");
}
}
main();
[/javascript]
[javascript]
Failure: Failed to execute script 'workspace://SpacesStore/7dafc316-11a9-4a81-8201-4ffa2a5dc572': 05140280 Failed to execute supplied script: 05140279 ReferenceError: "bpm_assignees" is not defined. (AlfrescoJS#7)
[/javascript]