cancel
Showing results for 
Search instead for 
Did you mean: 

My Tasks - Always Fails

theslacker
Champ in-the-making
Champ in-the-making
Hi all. I downloaded Alfresco Community 3.3 and am evaluating it for my company. I really like some aspects of it, but I am having trouble with one feature right out of the box. I installed on win XP using the exe installer. Install went well. Using Share works well except whenever I try to do anything in the My Tasks Dashlet, it never works. I get a Failed To Action Task message.

Here is an example:
- User requests access to site
- site owner has the activity in My Tasks to approve or reject
- site owner clicks either option and the Fail message comes up

I tried a whole variety of other tasks and they all fail.

Another example is accepting a workflow request.

I looked in the error log and one error I've seen is "Invalid Global ID" errors.

Any ideas? I really want to get this working as Alfresco looks awesome. I would think that out of the box the features would work.

Thanks!
38 REPLIES 38

ahwebguy
Champ in-the-making
Champ in-the-making
I'd really like to see a post telling us what to do about this other than wait.  We spend a lot of time chasing and reporting bugs and could use some help killing them.

mikeh
Star Contributor
Star Contributor
I'd really like to see a post telling us what to do about this other than wait.  We spend a lot of time chasing and reporting bugs and could use some help killing them.
The best way of tracking bug fixes is to watch our SVN checkins, either via twitter (@alfrescoeng) or SVN directly. We'll be opening up a Fisheye server too soon (I don't think it's public yet, as we're still testing internally).

The fix you want is detailed in http://issues.alfresco.com/jira/browse/ALF-260 which refers to SVN rev. 19829

Thanks,
Mike

kyriakos
Champ in-the-making
Champ in-the-making
thanx for the answer
can you tell me the path in svn?

mikeh
Star Contributor
Star Contributor
There are some great SVN help resources available from a quick Google search… however:
$ svn diff -c 19829
Index: projects/slingshot/source/web/components/dashlets/my-tasks.js
===================================================================
— projects/slingshot/source/web/components/dashlets/my-tasks.js   (revision 19828)
+++ projects/slingshot/source/web/components/dashlets/my-tasks.js   (revision 19829)
@@ -427,7 +427,7 @@

             var url = YAHOO.lang.substitute("api/workflow/task/end/{taskId}{transitionId}",
             {
-               taskId: taskId,
+               taskId: encodeURIComponent(taskId),
                transitionId: transitionId
             });

kyriakos
Champ in-the-making
Champ in-the-making
my problem seems to be there again after the change..my log file says

Caused by: org.alfresco.scripts.ScriptException: 03200003 Failed to execute scri
pt 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/workflow/en
d-task.post.js': 03200002 Invalid Global Id 'jbpm103'

are we changing the corrent file because here it says the error for end-task.post.js

kyriakos
Champ in-the-making
Champ in-the-making
i changed the file in web-inf directory

and i get this
13:01:41,515  ERROR [extensions.webscripts.AbstractRuntime] Exception from execu
teScript - redirecting to status template error: 03200006 Wrapped Exception (wit
h status template): 03200006 Error during processing of the template 'Expression
future is undefined on line 152, column 114 in org/alfresco/slingshot/dashlets/
my-tasks.get.json.ftl.'. Please contact your system administrator.
org.springframework.extensions.webscripts.WebScriptException: 03200006 Wrapped E
xception (with status template): 03200006 Error during processing of the templat
e 'Expression future is undefined on line 152, column 114 in org/alfresco/slings
hot/dashlets/my-tasks.get.json.ftl.'. Please contact your system administrator.

ahwebguy
Champ in-the-making
Champ in-the-making
Thanks Mike,

Changed that one line and the My Tasks dashlet is working correctly.

yzenezy
Champ in-the-making
Champ in-the-making
Hi,

I changed ./tomcat/webapps/share/components/dashlets/my-tasks.js but I still get an error when trying to complete tasks. Have I overlooked something?

I checked out HEAD and did a diff with my edit against HEAD and the file is the same as far as I can see. I've restarted Alfresco, too.

svn info projects/slingshot/source/web/components/dashlets/my-tasks.js
Path: projects/slingshot/source/web/components/dashlets/my-tasks.js
Name: my-tasks.js
URL: svn://svn.alfresco.com/alfresco/HEAD/root/projects/slingshot/source/web/components/dashlets/my-tasks.js
Repository Root: svn://svn.alfresco.com
Repository UUID: c73165b8-c2a3-4c3a-8162-ddfb506fd858
Revision: 19923
Node Kind: file
Schedule: normal
Last Changed Author: ewinlof
Last Changed Rev: 19829
Last Changed Date: 2010-04-13 19:55:58 +1000 (Tue, 13 Apr 2010)
Text Last Updated: 2010-04-14 15:33:25 +1000 (Wed, 14 Apr 2010)
Checksum: b694ef079ca359d94acab79a25b61000

diff projects/slingshot/source/web/components/dashlets/my-tasks.js /opt/Alfresco/tomcat/webapps/share/components/dashlets/my-tasks.js
echo $?
0

my-tasks.js
/**
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Dashboard MyTasks component.
*
* @namespace Alfresco
* @class Alfresco.MyTasks
*/
(function()
{
   /**
    * YUI Library aliases
    */
   var Dom = YAHOO.util.Dom,
       Event = YAHOO.util.Event;

   /**
    * Alfresco Slingshot aliases
    */
   var $html = Alfresco.util.encodeHTML;
  
   /**
    * Preferences
    */
   var PREFERENCES_MYTASKS = "org.alfresco.share.mytasks",
       PREF_FILTER = PREFERENCES_MYTASKS + ".filter";
  
   /**
    * Constants
    */
   var FILTER_ALL = "all";
   var FILTER_INVITES = "invites";
  
   /**
    * Dashboard MyTasks constructor.
    *
    * @param {String} htmlId The HTML id of the parent element
    * @return {Alfresco.MyTasks} The new component instance
    * @constructor
    */
   Alfresco.MyTasks = function MyTasks_constructor(htmlId)
   {
      Alfresco.MyTasks.superclass.constructor.call(this, "Alfresco.MyTasks", htmlId, ["button", "container"]);
     
      // Initialise prototype properties
      this.activeTaskTransitions = {};
     
      // Preferences service
      this.services.preferences = new Alfresco.service.Preferences();
     
      return this;
   }

   YAHOO.extend(Alfresco.MyTasks, Alfresco.component.Base,
   {
      /**
       * Object container for initialization options
       *
       * @property options
       * @type object
       */
      options:
      {
         /**
          * Currently active filter.
          *
          * @property activeFilter
          * @type string
          * @default "all"
          */
         activeFilter: FILTER_ALL
      },

      /**
       * Task list DOM container.
       *
       * @property taskList
       * @type object
       */
      taskList: null,

      /**
       *
       *
       * @property: activeTaskTransitions
       * @type: object
       */
      activeTaskTransitions: null,

      /**
       * Fired by YUI when parent element is available for scripting
       * @method onReady
       */
      onReady: function MyTasks_onReady()
      {
         var me = this;

         // "All" filter
         this.widgets.all = new YAHOO.widget.Button(this.id + "-all",
         {
            type: "checkbox",
            value: FILTER_ALL,
            checked: false
         });
         this.widgets.all.on("checkedChange", this.onAllCheckedChanged, this.widgets.all, this);
        
         // "Invites" filter
         this.widgets.invites = new YAHOO.widget.Button(this.id + "-invites",
         {
            type: "checkbox",
            value: FILTER_INVITES,
            checked: false
         });
         this.widgets.invites.on("checkedChange", this.onInvitesCheckedChanged, this.widgets.invites, this);
        
         // DueDate dropdown filter
         this.widgets.dueOn = new YAHOO.widget.Button(this.id + "-dueOn",
         {
            type: "split",
            menu: this.id + "-dueOn-menu",
            lazyloadmenu: false
         });
         this.widgets.dueOn.on("click", this.onDateFilterClicked, this, true);
         this.widgets.dueOn.getMenu().subscribe("click", function (p_sType, p_aArgs)
         {
            var menuItem = p_aArgs[1];
            if (menuItem)
            {
               me.widgets.dueOn.set("label", menuItem.cfg.getProperty("text"));
               me.onDateFilterChanged.call(me, p_aArgs[1]);
            }
         });
         this.widgets.dueOn.value = "today";

         // Hook events for task transitions
         var fnTaskHandler = function MyTasks_fnTaskHandler(layer, args)
         {
            var owner = YAHOO.Bubbling.getOwnerByTagName(args[1].anchor, "span");
            if (owner !== null)
            {
               var taskTransition = owner.className;
               me.onTransitionTask.call(me, taskTransition);
               args[1].stop = true;
            }
            return true;
         }
         YAHOO.Bubbling.addDefaultAction("task-transition", fnTaskHandler);
        
         // The task list container
         this.taskList = Dom.get(this.id + "-taskList");
        
         // Load preferences to override default filter
         this.services.preferences.request(PREF_FILTER,
         {
            successCallback:
            {
               fn: function(p_oResponse)
               {
                  var filterPreference = Alfresco.util.findValueByDotNotation(p_oResponse.json, PREF_FILTER, null);
                  if (filterPreference !== null)
                  {
                     // test for the two well known boolean filters - else a due date is specified
                     // therefore manually update the selected menu button label and highlight
                     switch (filterPreference)
                     {
                        case FILTER_ALL:
                           this.widgets.all.set("checked", true, true);
                           break;
                       
                        case FILTER_INVITES:
                           this.widgets.invites.set("checked", true, true);
                           break;
                       
                        default:
                        {
                           this.widgets.dueOn.value = filterPreference;
                          
                           // set the correct menu label
                           var menuItems = this.widgets.dueOn.getMenu().getItems();
                           for (index in menuItems)
                           {
                              if (menuItems.hasOwnProperty(index))
                              {
                                 if (menuItems[index].value === filterPreference)
                                 {
                                    this.widgets.dueOn.set("label", menuItems[index].cfg.getProperty("text"));
                                    Dom.addClass(this.widgets.dueOn.get("element"), "yui-checkbox-button-checked");
                                    break;
                                 }
                              }
                           }
                           break;
                        }
                     }
                     this.populateTaskList(filterPreference);
                  }
                  else
                  {
                     this.widgets.all.set("checked", true, true);
                     this.populateTaskList(FILTER_ALL);
                  }
               },
               scope: this
            },
            failureCallback:
            {
               fn: function()
               {
                  this.widgets.all.set("checked", true, true);
                  this.populateTaskList(FILTER_ALL);
               },
               scope: this
            }
         });
      },
     
      /**
       * Populate the task list via Ajax request
       * @method populateTaskList
       */
      populateTaskList: function MyTasks_populateTaskList(filter)
      {
         // Load the task list
         Alfresco.util.Ajax.request(
         {
            url: Alfresco.constants.URL_SERVICECONTEXT + "components/dashlets/my-tasks/list",
            dataObj:
            {
               filter: filter
            },
            successCallback:
            {
               fn: this.onTasksLoaded,
               scope: this,
               obj: filter
            },
            failureCallback:
            {
               fn: this.onTasksLoadFailed,
               scope: this
            },
            scope: this
         });
      },
     
      /**
       * Task list loaded successfully
       * @method onTasksLoaded
       * @param p_response {object} Response object from request
       */
      onTasksLoaded: function MyTasks_onTasksLoaded(p_response, p_obj)
      {
         // Reset transition so we don't stop any transitions from being sent
         this.activeTaskTransitions = {};
         this.options.activeFilter = p_obj;
         this.taskList.innerHTML = p_response.serverResponse.responseText;
      },

      /**
       * Task list load failed
       * @method onTasksLoadFailed
       */
      onTasksLoadFailed: function MyTasks_onTasksLoadFailed()
      {
         // Reset transition so we don't stop any transitions from being sent
         this.activeTaskTransitions = {};
         this.taskList.innerHTML = '<div class="detail-list-item first-item last-item"><span>' + this.msg("label.load-failed") + '</span></div>';
      },
     
      /**
       * Sets the active filter highlight in the UI
       * @method setActiveFilter
       * @param filter {string} The current filter
       */
      setActiveFilter: function MyTasks_setActiveFilter(filter)
      {
         switch (filter)
         {
            case FILTER_ALL:
               this.widgets.invites.set("checked", false, true);
               Dom.removeClass(this.widgets.dueOn.get("element"), "yui-checkbox-button-checked");
               break;

            case FILTER_INVITES:
               this.widgets.all.set("checked", false, true);
               Dom.removeClass(this.widgets.dueOn.get("element"), "yui-checkbox-button-checked");
               break;
           
            default:
               this.widgets.all.set("checked", false, true);
               this.widgets.invites.set("checked", false, true);
               Dom.addClass(this.widgets.dueOn.get("element"), "yui-checkbox-button-checked");
               break;
         }
      },
     
      /**
       * Task transitioned successfully
       * @method onTaskTransitionSuccess
       */
      onTaskTransitionSuccess: function MyTasks_onTaskTransitionSuccess()
      {
         this.populateTaskList(this.options.activeFilter);
      },

      /**
       * YUI WIDGET EVENT HANDLERS
       * Handlers for standard events fired from YUI widgets, e.g. "click"
       */

      /**
       * All tasks
       * @method onAllCheckedChanged
       * @param p_oEvent {object} Button event
       * @param p_obj {object} Button
       */
      onAllCheckedChanged: function MyTasks_onAllCheckedChanged(p_oEvent, p_obj)
      {
         this.setActiveFilter(FILTER_ALL);
         this.populateTaskList(FILTER_ALL);
         p_obj.set("checked", true, true);
         this.services.preferences.set(PREF_FILTER, FILTER_ALL);
      },

      /**
       * Invite tasks
       * @method onInvitesCheckedChanged
       * @param p_oEvent {object} Button event
       * @param p_obj {object} Button
       */
      onInvitesCheckedChanged: function MyTasks_onInvitesCheckedChanged(p_oEvent, p_obj)
      {
         this.setActiveFilter(FILTER_INVITES);
         this.populateTaskList(FILTER_INVITES);
         p_obj.set("checked", true, true);
         this.services.preferences.set(PREF_FILTER, FILTER_INVITES);
      },

      /**
       * Date button clicked event handler
       * @method onDateFilterClicked
       * @param p_oEvent {object} Dom event
       */
      onDateFilterClicked: function MyTasks_onDateFilterClicked(p_oEvent)
      {
         var filter =  this.widgets.dueOn.value;
         this.setActiveFilter(filter);
         this.populateTaskList(filter);
         this.services.preferences.set(PREF_FILTER, filter);
      },
     
      /**
       * Date drop-down changed event handler
       * @method onDateFilterChanged
       * @param p_oMenuItem {object} Selected menu item
       */
      onDateFilterChanged: function MyTasks_onDateFilterChanged(p_oMenuItem)
      {
         var filter = p_oMenuItem.value;
         this.widgets.dueOn.value = filter;
         this.setActiveFilter(filter);
         this.populateTaskList(filter);
         this.services.preferences.set(PREF_FILTER, filter);
      },


      /**
       * BUBBLING LIBRARY EVENT HANDLERS FOR ACTIONS
       * Disconnected event handlers for action event notification
       */

      /**
       * Task transition event handler
       * @method onTransitionTask
       * @param taskTransition {string} TaskId and TransitionId separated by space
       */
      onTransitionTask: function MyTasks_onTransitionTask(taskTransition)
      {
         var params = taskTransition.split(" ");
         var taskId = null;
         var transitionId = null;
        
         if (params.length == 1)
         {
            if (params[0].indexOf("jbpm$") != -1)
            {
               taskId = params[0];
               transitionId = "";
            }
         }
         else if (params.length == 2)
         {
            if (params[0].indexOf("jbpm$") != -1)
            {
               taskId = params[0];
               transitionId = "/" + params[1];
            }
            else
            {
               transitionId = "/" + params[0];
               taskId = params[1];
            }

         }

         if (taskId !== null && !this.activeTaskTransitions[taskId])
         {
            // Set this taskId to true so we don't send multiple calls for the same task
            this.activeTaskTransitions[taskId] = true;

            var url = YAHOO.lang.substitute("api/workflow/task/end/{taskId}{transitionId}",
            {
               taskId: encodeURIComponent(taskId),
               transitionId: transitionId
            });

            // Transition the task
            Alfresco.util.Ajax.request(
            {
               url: Alfresco.constants.PROXY_URI + url,
               method: "post",
               successCallback:
               {
                  fn: function()
                  {
                     this.onTaskTransitionSuccess();
                  },
                  scope: this
               },
               successMessage: this.msg("transition.success"),
               failureCallback:
               {
                  fn: function()
                  {
                     this.activeTaskTransitions[taskId] = false
                  },
                  scope: this
               },
               failureMessage: this.msg("transition.failure"),
               scope: this
            });
         }
      }
   });
})();

yzenezy
Champ in-the-making
Champ in-the-making
Never mind. I restarted my browser (firefox on linux) and it's working now. DOH!

kyriakos
Champ in-the-making
Champ in-the-making
ok i messed it up but now everything is ok Smiley Wink
thanx guys