cancel
Showing results for 
Search instead for 
Did you mean: 

Create Task for simple workflow

kiran_428
Champ in-the-making
Champ in-the-making
Hi, I am trying create a simple work flow for moving documents from one space to another space for approval using a rule .But I am not able to show this a task in the dash board.Can any one help me?

I am able to get this by creating advanced work flow , but I just wanted to do it using a rule.
23 REPLIES 23

witho
Champ on-the-rise
Champ on-the-rise
I am having the same problem. Does anyone get the solution to this issue???

Thanks!!!

witho
Champ on-the-rise
Champ on-the-rise
I think that is imposible to create a workflow with tasks using the action rule "add simple workflow." You shuold create a rule that "executes a script" and this scrit startys the workflow.

If you need any help just tell me.

tarl
Champ in-the-making
Champ in-the-making
Hello everybody!
I'm quite new on alfresco and I'm trying to takethe most of the simple workflows and spaces rules. I would like to create a simple workflow which 'll execute a script. Do you have an idea or any clues!
thx

witho
Champ on-the-rise
Champ on-the-rise
Hi Tarl,

If you want to execute script you can use a space rule and in the action you simply choose the option "Executes a script…" to set the script you want to execute.

Indeed, if you need to have a workflow that will be associated to a user who is the responsible of execute the action that will trigger the script you need to modify the simple workflow of alfresco.

For example I created an Approve / Reject worklflow tha in the Approve task executes a script which copy a documento and change the expiry date of this document. For this you need to edit the file review_proccessdefinition.xml like follows:

review_proccessdefinition.xml

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:review">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <transition name="" to="review" />
    </start-state>

    <swimlane name="reviewer">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>      
    </swimlane>

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
            </event>
        </task>
        <transition name="reject" to="end" >
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
               fechaInicial = new Date();
               fechaCaducidad = new Date();
               fechaCaducidad.setDate(fechaInicial.getDate() + 10);
               for (var i = 0; i &lt; bpm_package.children.length; i++){
                     bpm_package.children[i].properties["cm:expiryDate"] = fechaCaducidad;
                     bpm_package.children[i].save();
                  }
              </script>
           </action>
      </transition>
        <transition name="approve" to="end">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                  var dest = companyhome.childByNamePath(bpm_aproveDestination);
                  for (var i = 0; i &lt; bpm_package.children.length; i++){
                     bpm_package.children[i].copy(dest);
                  }
                  fechaInicial = new Date();
                  fechaCaducidad = new Date();
                  fechaCaducidad.setDate(fechaInicial.getDate() + 10);
                  for (var i = 0; i &lt; bpm_package.children.length; i++){
                        bpm_package.children[i].properties["cm:expiryDate"] = fechaCaducidad;
                        bpm_package.children[i].save();
                  }
              </script>
           </action>
      </transition>
    </task-node>

    <end-state name="end" />

</process-definition>

Then to launch this workflow I use a rule that execute a script and send a task Approve / Reject to the user I want. As yo see:

startWorkflow_CLIENTES.js

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = "Review source by Init Services.";
workflow.parameters["bpm:assignee"] = "responsibleUser";
workflow.parameters["bpm:aproveDestination"] = "THEINIT/CLIENTES";
workflow.execute(document);

I hope this will help.

tarl
Champ in-the-making
Champ in-the-making
thx witho for such a fast answer!
I understand what you say but this wil modify the Review &approve advanced workflow. It ll be better for me if I could add some scrpts to the simple wf. The one where the user can click on a button to launch the workflow. I hope you understand what I mean… More accurately, I want that a user who's done with a content in the drafts folder can click a button "request Approval" in the drop-down menu. This will launch the scripts and the workflow.
best regards
tarl

witho
Champ on-the-rise
Champ on-the-rise
Hi again Tarl,

For your porpose you can use webscripts, but I am not an expert in this stuff. I leave you some tutorials that I hope will help you, here you are:

http://wiki.alfresco.com/wiki/Web_Scripts
http://wiki.alfresco.com/wiki/Web_Scripts_Examples

Another option could be trying to edit the "start-workflow" action and add a "onclick" parameter before the action call. Something like this (I'm not sure if this will work…):

web-client-config-workflow-actions.xml


         <action id="start_workflow">
            <label-id>start_workflow</label-id>
            <image>/images/icons/new_workflow.gif</image>
            <evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>
            <onclick>javascript:yourFunction();return false;</onclick>
            <action>wizard:startWorkflow</action>
            <action-listener>#{WizardManager.setupParameters}</action-listener>
            <params>
               <param name="item-to-workflow">#{actionContext.id}</param>
            </params>
         </action>

tarl
Champ in-the-making
Champ in-the-making
thx witho! I think I get it!  any Idea for a script or web script to reach another web site (url)?
Anyway thx you !

witho
Champ on-the-rise
Champ on-the-rise
I am glad it worked!

I don't understand what exactly do you mean with "a script or web script to reach another web site (url)". Could be more specific?

Bye.

tarl
Champ in-the-making
Champ in-the-making
I need that when the script of my "workflow" will be executed  that it send information to  Redmine (another web application). I think the better solution ll be to call a Remine URL with parameters inside such as http://www.myRedmine.com/myAction/attribut1=value&attribut2=valueee
do you understand better?