Start workflow via JavaScript with the help of rules
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2008 06:06 AM
Hi,
I want to create a rule, with the "execute a script" actions. I want to start the advanced workflow with the help of the rules.
Actually I want to automaticly start the workflow by adding a new content.
for example:
a user adds a content
the (whitepaper) workflow starts in backgroound and send a task for a specific users,
these users recieve a task on their pool tasks list.
Is it possible to start a workflow by defining a rule, at the time of adding a new content????
I guess one solution is to use the javascript in the rule definition, but how should the script look like?
Thank you,
FSB
I want to create a rule, with the "execute a script" actions. I want to start the advanced workflow with the help of the rules.
Actually I want to automaticly start the workflow by adding a new content.
for example:
a user adds a content
the (whitepaper) workflow starts in backgroound and send a task for a specific users,
these users recieve a task on their pool tasks list.
Is it possible to start a workflow by defining a rule, at the time of adding a new content????
I guess one solution is to use the javascript in the rule definition, but how should the script look like?
Thank you,
FSB
Labels:
- Labels:
-
Archive
34 REPLIES 34
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2013 01:41 AM
hi
where did you define javascript file and how you integrate it .
where did you define javascript file and how you integrate it .
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2013 02:01 AM
hi,
i have kept my workflow process defination file in alfresco/classes/workflow folder and my java script in datadictionary/scripts folder also i have defined my process defination in bootstrap-context.xml as well but still when i approve a document it does not get moved to appropriate folder
and thanks for reply…..
i have kept my workflow process defination file in alfresco/classes/workflow folder and my java script in datadictionary/scripts folder also i have defined my process defination in bootstrap-context.xml as well but still when i approve a document it does not get moved to appropriate folder
and thanks for reply…..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2013 06:33 AM
hi,
i have my approve and rejected folders in company home am i giving the right paths in javascript above if any idea please help….
i have my approve and rejected folders in company home am i giving the right paths in javascript above if any idea please help….
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2013 03:06 PM
hi Kashyap,
are you solved your problem.?
are you solved your problem.?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 11:57 PM
Hi Everyone,
I am using the below code:
—–
function startWorkflow(assigneeGroup)
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReviewPooled";
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();
—————–
It is all working fine, but I want something more in it.
For example a user added a file called DCN10007.pdf and other supporting files of DCN10007.pdf user will tag the filename under each supporting file say for example.
XYZ.docx
ABC.XLSX
As both the above files are supporting documents of DCN10007.pdf, then user will add tag as "DCN10007" in both of the documents.
Now, I want that when a file with the name DCN is uploaded I get workflow created for all the 3 documents.
I appreciate, if anyone can tell me how to achieve this.
Regards
Ruchin Sharma
I am using the below code:
—–
function startWorkflow(assigneeGroup)
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReviewPooled";
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();
—————–
It is all working fine, but I want something more in it.
For example a user added a file called DCN10007.pdf and other supporting files of DCN10007.pdf user will tag the filename under each supporting file say for example.
XYZ.docx
ABC.XLSX
As both the above files are supporting documents of DCN10007.pdf, then user will add tag as "DCN10007" in both of the documents.
Now, I want that when a file with the name DCN is uploaded I get workflow created for all the 3 documents.
I appreciate, if anyone can tell me how to achieve this.
Regards
Ruchin Sharma
