cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement a automatic workflow?

kishore
Champ in-the-making
Champ in-the-making
Hi All,


         I already deployed several interactive workflows where my javascript which was set as a rule will invoke the specified workflow on arrival of docs on a space and the the task is assigned to someone and it will proceed without a problem.
           But i want to implement a simple automatic workflow without user initiation or intervention or task assignment to user.But it looks like initially a task should be assigned to atleast one initiator(user) then its possible.
           Is it right or am missing something?Can anybody guide in this regard.

Thanks
kishore
8 REPLIES 8

davidc
Star Contributor
Star Contributor
Hi kishore,

It's good to hear you've deployed some workflows.  How useful would it be to  setup an area for cataloging the kinds of workflows people have developed and deployed?  perhaps even with the workflow definitions.  That might save a lot of time in the long run.  I'd certainly like to know how people are using the building blocks we've put together.

Sorry, I ramble, back to your question.

Yes, it's possible to define completely automated workflows.  You can hook into the node-leave event of the <start-state> and add javascript/java actions.

There must always be a start task (it's used to provide parameters to thte workflow)  However, if you're using javascript to start the workflow, it is not necessary for the initiator to manually enter the information and end the task.  That can all be done in 'start workflow' javascript.

So if you had something like

<start-state>
   <task …>
   <event type="node-leave">
      <action class="….AlfrescoJavascript">
          ….
          ….
      </action>
   </event>
   <transition to="end">
</start-state>
<end-state name="end">

and kicked it off with the usual start workflow javascript, the code in the action will get executed followed by the ending of the workflow, without any user interaction.

kishore
Champ in-the-making
Champ in-the-making
Hi David,

             Thanks for your reply and its worked for me.As you suggested,i agree with that its really helpful to share the workflow etc among the community but i dont have idea how to do that,means in what way.

           Again special thanks to you for your quick response and for solution.

Thanks
Kishore

jagrutirout
Champ in-the-making
Champ in-the-making
Hi Kishore,

I also want to go for an  automated advanced workflo.I have developed a customized workflow and deplyed in alfresco.
But I am not able to automate it.The scenario is whenever any content uploaded to my created folfer for approval,the advanced work flow intiates automaticaly without any user initiation.Kindly help me out.

mitpatoliya
Star Collaborator
Star Collaborator
You can create one script which will initiate the workflow.
Then you have to set rule on the space that whenever document enter execute your script.
You can refer following post for that.
http://livinginjava.blogspot.in/2008/10/starting-alfresco-workflow-using.html

jagrutirout
Champ in-the-making
Champ in-the-making
Hi mitpatoliya,

I have followed thelink you had posted for script to automated my workflow.I hav created the script as Automated_workflow_script as mentioned below:-

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$sanz:Group_Email_Notification";
workflow.parameters["bpm:workflowDescription"] =Group_Email_Notification.name;
workflow.parameters["bpm:groupAssignee"] = people.getGroup("T_Approver");
workflow.parameters["sanz:notifyMe"] = true;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

I have created my  workflow as Group_Email_Notification and description is Group_Email_Notification.The approver group is T_Approver.I created the script successfully .The space name is Draft where I applied the rule to execute the script any document uploaded to this folder.But while uploading the document to Draft ,I got the following error:-

Please correct the errors below then click OK.
Failed to create content due to error: 01150013 Failed to execute script 'workspace://SpacesStore/b7f66288-966c-41a6-aae6-e0675c9c871f': 01150012 ReferenceError: "Group_Email_Notification" is not defined. (workspace://SpacesStore/b7f66288-966c-41a6-aae6-e0675c9c871f#3)


Please help me out.

mitpatoliya
Star Collaborator
Star Collaborator
Your problem lies in one of these lines.
workflow.parameters.workflowName = "jbpm$sanz:Group_Email_Notification";
workflow.parameters["bpm:workflowDescription"] =Group_Email_Notification.name;

workflow with this name should be deployed properly in alfresco jbpm$sanz:Group_Email_Notification
description should be any simple string like
workflow.parameters["bpm:workflowDescription"] ="Group_Email_Notification";

jagrutirout
Champ in-the-making
Champ in-the-making
Hi mitpatoliya,

I have already deployed my workflow using jbpm.Its working fine if i will start it manually. But after writing the script , while i try to upload a documnet in the Draft folder,I am getting the error.Can you suggest?

mitpatoliya
Star Collaborator
Star Collaborator
then its surly problem with this line.

workflow.parameters["bpm:workflowDescription"] =Group_Email_Notification.name;

have you tried replacing Group_Email_Notification.name with some string like

workflow.parameters["bpm:workflowDescription"] ="testingggg";

??