cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow - Problem with initiator user

conghung
Champ in-the-making
Champ in-the-making
Please help us. I high appreciate for your help.

- One user(A) creates a new workflow, then he assigns it to another (B). When A clicks on "Workflow I've started", he can control everything with tasks of the workflow(review, approve, etc..).
However, I only want that only B can do(review, approve) and A don't have control (review, approve) to these tasks. Could we do it? how?

I'm pretty new to Alfresco, so I appreciate any nudges in the right direction.
4 REPLIES 4

sanket
Champ on-the-rise
Champ on-the-rise
Yes. You can achieve it.
You need to disable the "Edit task" and "Task details" actions available in the workflow-details page.

The ftl file for it is workflow-form.get.html.ftl (tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\workflow)
and the equivalent js file where you can customize your business logic is workflow-form.js (tomcat\webapps\share\components\workflow)

NOTE: Do not change the OOTB files. Put it under the extension environment to customize.

conghung
Champ in-the-making
Champ in-the-making
Many thanks Sanket!

conghung
Champ in-the-making
Champ in-the-making
To disabled the "Edit task" and "Task details" actions available in the workflow-details page, I comment out case "Editable" on file workflow-form.js as below:
At function WorkflowForm_renderCellType():
renderCellType: function WorkflowForm_renderCellType(elCell, oRecord, oColumn, oData)
      {
         var task = oRecord.getData();
         /*if (task.isEditable)
         {
            elCell.innerHTML = '<a href="' + this._getTaskUrl("task-edit", oRecord.getData("id")) + '" title="' + this.msg("link.title.task-edit") + '">' + $html(oRecord.getData("title")) + '</a>';
         }
         else
         {*/
            elCell.innerHTML = '<a href="' + this._getTaskUrl("task-details", oRecord.getData("id")) + '" title="' + this.msg("link.title.task-details") + '">' + $html(oRecord.getData("title")) + '</a>';
         /*}*/
      },

At function function WorkflowForm_renderCellCurrentTasksActions():
renderCellCurrentTasksActions: function WorkflowForm_renderCellCurrentTasksActions(elCell, oRecord, oColumn, oData)
      {
         var task = oRecord.getData();
         elCell.innerHTML += '<a href="' + this._getTaskUrl("task-details", task.id) + '" class="task-details" title="' + this.msg("link.title.task-details") + '"> </a>';
         /*if (task.isEditable)
         {
            elCell.innerHTML += '<a href="' + this._getTaskUrl("task-edit", task.id) + '" class="task-edit" title="' + this.msg("link.title.task-edit") + '"> </a>';
         }*/
      }

When user A(user start workflow) show history,  cannot edit task (click link in current task), it's ok.
However, when user B(user assigned) show workflow detail, he also cannot edit task(click link in current task)

can you help me only disable edit task of user A. enable edit task with user B.
thank you very much!

sanket
Champ on-the-rise
Champ on-the-rise
Replace the function renderCellCurrentTasksActions with below code. And add a new function below it. Let me know if it works for you.


renderCellCurrentTasksActions: function WorkflowForm_renderCellCurrentTasksActions(elCell, oRecord, oColumn, oData)
      {
         var task = oRecord.getData();
       var myWorkflowsLinkBack =  this.getUrlVars(window.location.href)["myWorkflowsLinkBack"];
       if(myWorkflowsLinkBack == null)
       {
        elCell.innerHTML += '<a href="' + this._getTaskUrl("task-details", task.id) + '" class="task-details" title="' + this.msg("link.title.task-details") + '"> </a>';
          if (task.isEditable)
          {
            elCell.innerHTML += '<a href="' + this._getTaskUrl("task-edit", task.id) + '" class="task-edit" title="' + this.msg("link.title.task-edit") + '"> </a>';
          }
       }
      },
    
      getUrlVars : function getUrlVars(url)
       {
           var vars = {};
           var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
               vars[key] = value;
           });
           return vars;
       }