<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to automatically claim a task as soon as it is opened in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82984#M25447</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/76783" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN class="login-bold"&gt;EddieMay,&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I want the task to be claimed means it should move the task from unassigned to assigned task and task should move under "me" in Assignee.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Later on I got the solution. U can see below. I added following code in event and it worked perfectly. THANKS ONCE AGAIN...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;--------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;onTaskDetailedData: function TEH_onTaskDetailedData(layer, args)&lt;BR /&gt;{&lt;BR /&gt;var task = args[1];&lt;/P&gt;&lt;P&gt;// Save task id so we can use it when invoking actions later&lt;BR /&gt;this.taskId = task.id;&lt;/P&gt;&lt;P&gt;// Save the referrer value&lt;BR /&gt;this.referrerValue = Alfresco.util.getQueryStringParameter('referrer');&lt;/P&gt;&lt;P&gt;// Display actions and create yui buttons&lt;BR /&gt;Selector.query("h1 span", this.id, true).innerHTML = $html(task.title);&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;if (task.isClaimable){&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;this._updateTaskProperties(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;"cm_owner": Alfresco.constants.USERNAME&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;}, "claim");&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;/** this._updateTaskProperties(&lt;BR /&gt;{&lt;BR /&gt;"cm_owner": Alfresco.constants.USERNAME&lt;BR /&gt;}, "claim");&lt;BR /&gt;**/&lt;BR /&gt;&lt;BR /&gt;var item = document.getElementById("page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems-cntrl");&lt;BR /&gt;//var len = item.children.length;&lt;BR /&gt;console.log("item "+item);&lt;BR /&gt;var docNodeRef;&lt;BR /&gt;&lt;BR /&gt;var attachment = document.getElementById("page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems");&lt;BR /&gt;//console.log("attachment "+attachment);&lt;BR /&gt;var url = window.location.href;&lt;BR /&gt;//console.log("url "+url);&lt;BR /&gt;url = url.substring(0, url.indexOf("share"));&lt;BR /&gt;//console.log("url "+url);&lt;BR /&gt;url = url.replace("share","alfresco");&lt;BR /&gt;//url = url.replace("8180","8080");&lt;BR /&gt;//console.log("url"+url);&lt;BR /&gt;if(attachment) {&lt;BR /&gt;docNodeRef = attachment.value;&lt;BR /&gt;docNodeRef = docNodeRef.substring(docNodeRef.lastIndexOf("/")+1,docNodeRef.length)&lt;BR /&gt;console.log("docNodeRef "+docNodeRef);&lt;BR /&gt;console.log(url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef);&lt;BR /&gt;&lt;BR /&gt;if(document.getElementById("docpreviewer")) {&lt;BR /&gt;document.getElementById("docpreviewer").data = url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef;&lt;BR /&gt;}&lt;BR /&gt;if(document.getElementById("attachmentlink"))&lt;BR /&gt;document.getElementById("attachmentlink").href = url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// ALF-13115 fix, inform user that this task has been completed&lt;BR /&gt;if (!task.isEditable)&lt;BR /&gt;{&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("message.task.completed"),&lt;BR /&gt;displayTime: 2&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;YAHOO.lang.later(2000, this, function()&lt;BR /&gt;{&lt;BR /&gt;// Check referrer and fall back to user dashboard if unavailable.&lt;BR /&gt;if(this.referrerValue)&lt;BR /&gt;{&lt;BR /&gt;if(this.referrerValue == 'tasks')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-tasks");&lt;BR /&gt;}&lt;BR /&gt;else if(this.referrerValue='workflows')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-workflows");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;document.location.href = this.getSiteDefaultUrl() || Alfresco.constants.URL_CONTEXT;&lt;BR /&gt;}&lt;BR /&gt;}, []);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (task.isReassignable)&lt;BR /&gt;{&lt;BR /&gt;// Task is reassignable&lt;BR /&gt;this.widgets.reassignButton = Alfresco.util.createYUIButton(this, "reassign", this.onReassignButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .reassign", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (task.isClaimable)&lt;BR /&gt;{&lt;BR /&gt;// Task is claimable&lt;BR /&gt;this.widgets.claimButton = Alfresco.util.createYUIButton(this, "claim", this.onClaimButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .claim", this.id), "hidden");&lt;BR /&gt;Dom.removeClass(Selector.query(".unassigned-message", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (task.isReleasable)&lt;BR /&gt;{&lt;BR /&gt;// Task is releasable&lt;BR /&gt;this.widgets.releaseButton = Alfresco.util.createYUIButton(this, "release", this.onReleaseButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .release", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 07:01:51 GMT</pubDate>
    <dc:creator>Rahul_Nathwani</dc:creator>
    <dc:date>2020-03-05T07:01:51Z</dc:date>
    <item>
      <title>How to automatically claim a task as soon as it is opened</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82982#M25445</link>
      <description>&lt;P&gt;/**This File is&amp;nbsp; &amp;nbsp;"task-edit-header.js" which is used for the header of the task when a workflow is started.&lt;/P&gt;&lt;P&gt;There is a claim button on the top by clicking the button it will trigger "onClaimButtonClick" event and that event will call a function. So now what I want to do is as soon as the user opens a task it should automatically claim that task by calling that&amp;nbsp;"onClaimButtonClick" event.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me what I can do..? Thanks in advance&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Copyright (C) 2005-2013 Alfresco Software Limited.&lt;BR /&gt;*&lt;BR /&gt;* This file is part of Alfresco&lt;BR /&gt;*&lt;BR /&gt;* Alfresco is free software: you can redistribute it and/or modify&lt;BR /&gt;* it under the terms of the GNU Lesser General Public License as published by&lt;BR /&gt;* the Free Software Foundation, either version 3 of the License, or&lt;BR /&gt;* (at your option) any later version.&lt;BR /&gt;*&lt;BR /&gt;* Alfresco is distributed in the hope that it will be useful,&lt;BR /&gt;* but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;BR /&gt;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&lt;BR /&gt;* GNU Lesser General Public License for more details.&lt;BR /&gt;*&lt;BR /&gt;* You should have received a copy of the GNU Lesser General Public License&lt;BR /&gt;* along with Alfresco. If not, see &amp;lt;&lt;A href="http://www.gnu.org/licenses/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.gnu.org/licenses/&lt;/A&gt;&amp;gt;.&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* TaskEditHeader component.&lt;BR /&gt;*&lt;BR /&gt;* @namespace Alfresco.component&lt;BR /&gt;* @class Alfresco.component.TaskEditHeader&lt;BR /&gt;*/&lt;BR /&gt;(function()&lt;BR /&gt;{&lt;BR /&gt;/**&lt;BR /&gt;* YUI Library aliases&lt;BR /&gt;*/&lt;BR /&gt;var Dom = YAHOO.util.Dom,&lt;BR /&gt;Event = YAHOO.util.Event,&lt;BR /&gt;Selector = YAHOO.util.Selector;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Alfresco Slingshot aliases&lt;BR /&gt;*/&lt;BR /&gt;var $html = Alfresco.util.encodeHTML,&lt;BR /&gt;$hasEventInterest = Alfresco.util.hasEventInterest,&lt;BR /&gt;$siteURL = Alfresco.util.siteURL;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* TaskEditHeader constructor.&lt;BR /&gt;*&lt;BR /&gt;* @param {String} htmlId The HTML id of the parent element&lt;BR /&gt;* @return {Alfresco.component.TaskEditHeader} The new TaskEditHeader instance&lt;BR /&gt;* @constructor&lt;BR /&gt;*/&lt;BR /&gt;Alfresco.component.TaskEditHeader = function TaskEditHeader_constructor(htmlId)&lt;BR /&gt;{&lt;BR /&gt;Alfresco.component.TaskEditHeader.superclass.constructor.call(this, htmlId, ["button"]);&lt;/P&gt;&lt;P&gt;// Re-register with our own name&lt;BR /&gt;this.name = "Alfresco.component.TaskEditHeader";&lt;/P&gt;&lt;P&gt;// Instance variables&lt;BR /&gt;this.options = YAHOO.lang.merge(this.options, Alfresco.component.TaskEditHeader.superclass.options);&lt;BR /&gt;Alfresco.util.ComponentManager.reregister(this);&lt;BR /&gt;this.isRunning = false;&lt;BR /&gt;this.taskId = null;&lt;/P&gt;&lt;P&gt;/* Decoupled event listeners */&lt;BR /&gt;YAHOO.Bubbling.on("taskDetailedData", this.onTaskDetailedData, this);&lt;/P&gt;&lt;P&gt;return this;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;YAHOO.extend(Alfresco.component.TaskEditHeader, Alfresco.component.ShareFormManager,&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Keeps track if this component is running an action or not&lt;BR /&gt;*&lt;BR /&gt;* @property isRunning&lt;BR /&gt;* &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/8999"&gt;@type&lt;/A&gt; Boolean&lt;BR /&gt;*/&lt;BR /&gt;isRunning: false,&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* The task instance id&lt;BR /&gt;*&lt;BR /&gt;* @property taskId&lt;BR /&gt;* &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/8999"&gt;@type&lt;/A&gt; String&lt;BR /&gt;*/&lt;BR /&gt;taskId: null,&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* The referrer value query string parameter&lt;BR /&gt;*&lt;BR /&gt;* @property referrerValue&lt;BR /&gt;* &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/8999"&gt;@type&lt;/A&gt; String&lt;BR /&gt;*/&lt;BR /&gt;referrerValue: null,&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Fired by YUI when parent element is available for scripting.&lt;BR /&gt;* Template initialisation, including instantiation of YUI widgets and event listener binding.&lt;BR /&gt;*&lt;BR /&gt;* @method onReady&lt;BR /&gt;*/&lt;BR /&gt;onReady: function TEH_onReady()&lt;BR /&gt;{&lt;BR /&gt;console.log("TaskEditHeader ");&lt;BR /&gt;// Load in the People Finder component from the server&lt;BR /&gt;Alfresco.util.Ajax.request(&lt;BR /&gt;{&lt;BR /&gt;url: Alfresco.constants.URL_SERVICECONTEXT + "components/people-finder/people-finder",&lt;BR /&gt;dataObj:&lt;BR /&gt;{&lt;BR /&gt;htmlid: this.id + "-peopleFinder"&lt;BR /&gt;},&lt;BR /&gt;successCallback:&lt;BR /&gt;{&lt;BR /&gt;fn: this.onPeopleFinderLoaded,&lt;BR /&gt;scope: this&lt;BR /&gt;},&lt;BR /&gt;failureMessage: "Could not load People Finder component",&lt;BR /&gt;execScripts: true&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Format dates (datatype could be 'date' or 'datetime')&lt;BR /&gt;var dateEls = document.querySelectorAll('[data-datatype^="date"]');&lt;BR /&gt;for (var i = 0; i &amp;lt; dateEls.length; i++) {&lt;BR /&gt;var formatString = 'date-format.default'; // Default to date time format&lt;BR /&gt;if (dateEls[i].getAttribute('data-datatype') === 'date') {&lt;BR /&gt;formatString = 'date-format.mediumDate';&lt;BR /&gt;}&lt;BR /&gt;dateEls[i].innerHTML = Alfresco.util.formatDate(dateEls[i].innerHTML, Alfresco.util.message(formatString));&lt;BR /&gt;};&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Called when the people finder template has been loaded.&lt;BR /&gt;* Creates a dialog and inserts the people finder for choosing assignees.&lt;BR /&gt;*&lt;BR /&gt;* @method onPeopleFinderLoaded&lt;BR /&gt;* @param response The server response&lt;BR /&gt;*/&lt;BR /&gt;onPeopleFinderLoaded: function TEH_onPeopleFinderLoaded(response)&lt;BR /&gt;{&lt;BR /&gt;// Inject the component from the XHR request into it's placeholder DIV element&lt;BR /&gt;var finderDiv = Dom.get(this.id + "-peopleFinder");&lt;BR /&gt;finderDiv.innerHTML = response.serverResponse.responseText;&lt;/P&gt;&lt;P&gt;// Create the Assignee dialog&lt;BR /&gt;this.widgets.reassignPanel = Alfresco.util.createYUIPanel(this.id + "-reassignPanel");&lt;/P&gt;&lt;P&gt;// Find the People Finder by container ID&lt;BR /&gt;this.widgets.peopleFinder = Alfresco.util.ComponentManager.get(this.id + "-peopleFinder");&lt;/P&gt;&lt;P&gt;// Set the correct options for our use&lt;BR /&gt;this.widgets.peopleFinder.setOptions(&lt;BR /&gt;{&lt;BR /&gt;singleSelectMode: true,&lt;BR /&gt;addButtonLabel: this.msg("button.select")&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Make sure we listen for events when the user selects a person&lt;BR /&gt;YAHOO.Bubbling.on("personSelected", this.onPersonSelected, this);&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Called when the user has selected an assigne from the people finder.&lt;BR /&gt;*&lt;BR /&gt;* @method onPersonSelected&lt;BR /&gt;* @param e DomEvent&lt;BR /&gt;* @param args Event parameters (depends on event type)&lt;BR /&gt;*/&lt;BR /&gt;onPersonSelected: function TEH_onPersonSelected(e, args)&lt;BR /&gt;{&lt;BR /&gt;// This is a "global" event so we ensure the event is for the current panel by checking panel visibility.&lt;BR /&gt;if ($hasEventInterest(this.widgets.peopleFinder, args))&lt;BR /&gt;{&lt;BR /&gt;this.widgets.reassignPanel.hide();&lt;BR /&gt;this._updateTaskProperties(&lt;BR /&gt;{&lt;BR /&gt;"cm_owner": args[1].userName&lt;BR /&gt;}, "reassign");&lt;BR /&gt;}&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Event handler called when the "taskDetailedData" event is received&lt;BR /&gt;*&lt;BR /&gt;* @method: onTaskDetailedData&lt;BR /&gt;*/&lt;BR /&gt;onTaskDetailedData: function TEH_onTaskDetailedData(layer, args)&lt;BR /&gt;{&lt;BR /&gt;var task = args[1];&lt;/P&gt;&lt;P&gt;// Save task id so we can use it when invoking actions later&lt;BR /&gt;this.taskId = task.id;&lt;/P&gt;&lt;P&gt;// Save the referrer value&lt;BR /&gt;this.referrerValue = Alfresco.util.getQueryStringParameter('referrer');&lt;/P&gt;&lt;P&gt;// Display actions and create yui buttons&lt;BR /&gt;Selector.query("h1 span", this.id, true).innerHTML = $html(task.title);&lt;/P&gt;&lt;P&gt;// ALF-13115 fix, inform user that this task has been completed&lt;BR /&gt;if (!task.isEditable)&lt;BR /&gt;{&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("message.task.completed"),&lt;BR /&gt;displayTime: 2&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;YAHOO.lang.later(2000, this, function()&lt;BR /&gt;{&lt;BR /&gt;// Check referrer and fall back to user dashboard if unavailable.&lt;BR /&gt;if(this.referrerValue)&lt;BR /&gt;{&lt;BR /&gt;if(this.referrerValue == 'tasks')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-tasks");&lt;BR /&gt;}&lt;BR /&gt;else if(this.referrerValue='workflows')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-workflows");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;document.location.href = this.getSiteDefaultUrl() || Alfresco.constants.URL_CONTEXT;&lt;BR /&gt;}&lt;BR /&gt;}, []);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (task.isReassignable)&lt;BR /&gt;{&lt;BR /&gt;// Task is reassignable&lt;BR /&gt;this.widgets.reassignButton = Alfresco.util.createYUIButton(this, "reassign", this.onReassignButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .reassign", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;if (task.isClaimable)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;// Task is claimable&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;this.widgets.claimButton = Alfresco.util.createYUIButton(this, "claim", this.onClaimButtonClick);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dom.removeClass(Selector.query(".actions .claim", this.id), "hidden");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Dom.removeClass(Selector.query(".unassigned-message", this.id), "hidden");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;if (task.isReleasable)&lt;BR /&gt;{&lt;BR /&gt;// Task is releasable&lt;BR /&gt;this.widgets.releaseButton = Alfresco.util.createYUIButton(this, "release", this.onReleaseButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .release", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Event handler called when the "release" button is clicked&lt;BR /&gt;*&lt;BR /&gt;* @method: onReleaseButtonClick&lt;BR /&gt;*/&lt;BR /&gt;onReleaseButtonClick: function TEH_onReleaseButtonClick(layer, args)&lt;BR /&gt;{&lt;BR /&gt;this._updateTaskProperties(&lt;BR /&gt;{&lt;BR /&gt;"cm_owner": null&lt;BR /&gt;}, "release");&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Event handler called when the "claim" button is clicked&lt;BR /&gt;*&lt;BR /&gt;* @method: onClaimButtonClick&lt;BR /&gt;*/&lt;BR /&gt;&lt;STRONG&gt;onClaimButtonClick: function TEH_onClaimButtonClick(layer, args)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;this._updateTaskProperties(&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"cm_owner": Alfresco.constants.USERNAME&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}, "claim");&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Event handler called when the "reassign" button is clicked&lt;BR /&gt;*&lt;BR /&gt;* @method: onReassignButtonClick&lt;BR /&gt;*/&lt;BR /&gt;onReassignButtonClick: function TEH_onReassignButtonClick(layer, args)&lt;BR /&gt;{&lt;BR /&gt;this.widgets.peopleFinder.clearResults();&lt;BR /&gt;this.widgets.reassignPanel.show();&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Updates a task property&lt;BR /&gt;*&lt;BR /&gt;* @method: _updateTaskProperties&lt;BR /&gt;* @private&lt;BR /&gt;*/&lt;BR /&gt;_updateTaskProperties: function TEH__updateTaskProperties(properties, action)&lt;BR /&gt;{&lt;BR /&gt;this._disableActionButtons(true);&lt;BR /&gt;YAHOO.lang.later(2000, this, function()&lt;BR /&gt;{&lt;BR /&gt;if (this.isRunning)&lt;BR /&gt;{&lt;BR /&gt;if (!this.widgets.feedbackMessage)&lt;BR /&gt;{&lt;BR /&gt;this.widgets.feedbackMessage = Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("message." + action),&lt;BR /&gt;spanClass: "wait",&lt;BR /&gt;displayTime: 0&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;else if (!this.widgets.feedbackMessage.cfg.getProperty("visible"))&lt;BR /&gt;{&lt;BR /&gt;this.widgets.feedbackMessage.show();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}, []);&lt;/P&gt;&lt;P&gt;// Run rules for folder (and sub folders)&lt;BR /&gt;if (!this.isRunning)&lt;BR /&gt;{&lt;BR /&gt;this.isRunning = true;&lt;/P&gt;&lt;P&gt;// Start/stop inherit rules from parent folder&lt;BR /&gt;Alfresco.util.Ajax.jsonPut(&lt;BR /&gt;{&lt;BR /&gt;url: Alfresco.constants.PROXY_URI_RELATIVE + "api/task-instances/" + this.taskId,&lt;BR /&gt;dataObj: properties,&lt;BR /&gt;successCallback:&lt;BR /&gt;{&lt;BR /&gt;fn: function(response, action)&lt;BR /&gt;{&lt;BR /&gt;this.isRunning = false;&lt;BR /&gt;var data = response.json.data;&lt;BR /&gt;if (data)&lt;BR /&gt;{&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("message." + action + ".success")&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;YAHOO.lang.later(3000, this, function(data)&lt;BR /&gt;{&lt;BR /&gt;if (data.owner &amp;amp;&amp;amp; data.owner.userName == Alfresco.constants.USERNAME)&lt;BR /&gt;{&lt;BR /&gt;// MNT-11418: Save previous URL&lt;BR /&gt;if (YAHOO.env.ua.chrome &amp;gt; 0)&lt;BR /&gt;{&lt;BR /&gt;var prevUrl = (history.state &amp;amp;&amp;amp; history.state.previous_url) ? history.state.previous_url : document.referrer;&lt;BR /&gt;var currUrl = document.location.href;&lt;BR /&gt;if (prevUrl &amp;amp;&amp;amp; prevUrl != "")&lt;BR /&gt;{&lt;BR /&gt;history.pushState({'previous_url': prevUrl, 'current_url': currUrl}, document.title, "");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;// Let the user keep working on the task since he claimed it&lt;BR /&gt;document.location.reload();&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// Check referrer and fall back to user dashboard if unavailable.&lt;BR /&gt;if(this.referrerValue)&lt;BR /&gt;{&lt;BR /&gt;// MNT-10182. The user may not have rights to see task details any more.&lt;BR /&gt;if (this.referrerValue == 'tasks')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-tasks");&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// Take the user to the most suitable place&lt;BR /&gt;this.navigateForward(true);&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;// ALF-20001. If referrer isn't available, either because there was no previous page&lt;BR /&gt;// (because the user navigated directly to the page via an emailed link)&lt;BR /&gt;// or because the referrer header has been blocked, fall back to user dashboard.&lt;BR /&gt;document.location.href = this.getSiteDefaultUrl() || Alfresco.constants.URL_CONTEXT;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}, data);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;},&lt;BR /&gt;obj: action,&lt;BR /&gt;scope: this&lt;BR /&gt;},&lt;BR /&gt;failureCallback:&lt;BR /&gt;{&lt;BR /&gt;fn: function(response)&lt;BR /&gt;{&lt;BR /&gt;this.isRunning = false;&lt;BR /&gt;this._disableActionButtons(false);&lt;BR /&gt;Alfresco.util.PopupManager.displayPrompt(&lt;BR /&gt;{&lt;BR /&gt;title: this.msg("message.failure"),&lt;BR /&gt;text: this.msg("message." + action + ".failure")&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;scope: this&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;_disableActionButtons: function(disabled)&lt;BR /&gt;{&lt;BR /&gt;if (this.widgets.reassignButton)&lt;BR /&gt;{&lt;BR /&gt;this.widgets.reassignButton.set("disabled", disabled)&lt;BR /&gt;}&lt;BR /&gt;if (this.widgets.releaseButton)&lt;BR /&gt;{&lt;BR /&gt;this.widgets.releaseButton.set("disabled", disabled)&lt;BR /&gt;}&lt;BR /&gt;if (this.widgets.claimButton)&lt;BR /&gt;{&lt;BR /&gt;this.widgets.claimButton.set("disabled", disabled)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt;})();&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 13:05:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82982#M25445</guid>
      <dc:creator>Rahul_Nathwani</dc:creator>
      <dc:date>2020-02-13T13:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically claim a task as soon as it is opened</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82983#M25446</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/79991"&gt;@Rahul_Nathwani&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Could I just clarify your requirement? When a user clicks this button in a workflow, you want the that task to be claimed by what task?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 14:09:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82983#M25446</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-02-21T14:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically claim a task as soon as it is opened</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82984#M25447</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/76783" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN class="login-bold"&gt;EddieMay,&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I want the task to be claimed means it should move the task from unassigned to assigned task and task should move under "me" in Assignee.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Later on I got the solution. U can see below. I added following code in event and it worked perfectly. THANKS ONCE AGAIN...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;--------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;onTaskDetailedData: function TEH_onTaskDetailedData(layer, args)&lt;BR /&gt;{&lt;BR /&gt;var task = args[1];&lt;/P&gt;&lt;P&gt;// Save task id so we can use it when invoking actions later&lt;BR /&gt;this.taskId = task.id;&lt;/P&gt;&lt;P&gt;// Save the referrer value&lt;BR /&gt;this.referrerValue = Alfresco.util.getQueryStringParameter('referrer');&lt;/P&gt;&lt;P&gt;// Display actions and create yui buttons&lt;BR /&gt;Selector.query("h1 span", this.id, true).innerHTML = $html(task.title);&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;if (task.isClaimable){&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;this._updateTaskProperties(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;"cm_owner": Alfresco.constants.USERNAME&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;}, "claim");&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;/** this._updateTaskProperties(&lt;BR /&gt;{&lt;BR /&gt;"cm_owner": Alfresco.constants.USERNAME&lt;BR /&gt;}, "claim");&lt;BR /&gt;**/&lt;BR /&gt;&lt;BR /&gt;var item = document.getElementById("page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems-cntrl");&lt;BR /&gt;//var len = item.children.length;&lt;BR /&gt;console.log("item "+item);&lt;BR /&gt;var docNodeRef;&lt;BR /&gt;&lt;BR /&gt;var attachment = document.getElementById("page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems");&lt;BR /&gt;//console.log("attachment "+attachment);&lt;BR /&gt;var url = window.location.href;&lt;BR /&gt;//console.log("url "+url);&lt;BR /&gt;url = url.substring(0, url.indexOf("share"));&lt;BR /&gt;//console.log("url "+url);&lt;BR /&gt;url = url.replace("share","alfresco");&lt;BR /&gt;//url = url.replace("8180","8080");&lt;BR /&gt;//console.log("url"+url);&lt;BR /&gt;if(attachment) {&lt;BR /&gt;docNodeRef = attachment.value;&lt;BR /&gt;docNodeRef = docNodeRef.substring(docNodeRef.lastIndexOf("/")+1,docNodeRef.length)&lt;BR /&gt;console.log("docNodeRef "+docNodeRef);&lt;BR /&gt;console.log(url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef);&lt;BR /&gt;&lt;BR /&gt;if(document.getElementById("docpreviewer")) {&lt;BR /&gt;document.getElementById("docpreviewer").data = url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef;&lt;BR /&gt;}&lt;BR /&gt;if(document.getElementById("attachmentlink"))&lt;BR /&gt;document.getElementById("attachmentlink").href = url +"share/proxy/alfresco/api/node/content/workspace/SpacesStore/"+docNodeRef;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// ALF-13115 fix, inform user that this task has been completed&lt;BR /&gt;if (!task.isEditable)&lt;BR /&gt;{&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("message.task.completed"),&lt;BR /&gt;displayTime: 2&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;YAHOO.lang.later(2000, this, function()&lt;BR /&gt;{&lt;BR /&gt;// Check referrer and fall back to user dashboard if unavailable.&lt;BR /&gt;if(this.referrerValue)&lt;BR /&gt;{&lt;BR /&gt;if(this.referrerValue == 'tasks')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-tasks");&lt;BR /&gt;}&lt;BR /&gt;else if(this.referrerValue='workflows')&lt;BR /&gt;{&lt;BR /&gt;document.location.href = $siteURL("my-workflows");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;document.location.href = this.getSiteDefaultUrl() || Alfresco.constants.URL_CONTEXT;&lt;BR /&gt;}&lt;BR /&gt;}, []);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (task.isReassignable)&lt;BR /&gt;{&lt;BR /&gt;// Task is reassignable&lt;BR /&gt;this.widgets.reassignButton = Alfresco.util.createYUIButton(this, "reassign", this.onReassignButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .reassign", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (task.isClaimable)&lt;BR /&gt;{&lt;BR /&gt;// Task is claimable&lt;BR /&gt;this.widgets.claimButton = Alfresco.util.createYUIButton(this, "claim", this.onClaimButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .claim", this.id), "hidden");&lt;BR /&gt;Dom.removeClass(Selector.query(".unassigned-message", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (task.isReleasable)&lt;BR /&gt;{&lt;BR /&gt;// Task is releasable&lt;BR /&gt;this.widgets.releaseButton = Alfresco.util.createYUIButton(this, "release", this.onReleaseButtonClick);&lt;BR /&gt;Dom.removeClass(Selector.query(".actions .release", this.id), "hidden");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 07:01:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82984#M25447</guid>
      <dc:creator>Rahul_Nathwani</dc:creator>
      <dc:date>2020-03-05T07:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically claim a task as soon as it is opened</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82985#M25448</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/79991"&gt;@Rahul_Nathwani&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Great that you found a solution and that you posted your solution here - I'm sure this will be helpful to other users.&lt;/P&gt;
&lt;P&gt;All the best,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:09:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-automatically-claim-a-task-as-soon-as-it-is-opened/m-p/82985#M25448</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-03-06T12:09:32Z</dc:date>
    </item>
  </channel>
</rss>

