<?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: I want to sort my-task in alfresco share in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107744#M30331</link>
    <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/36939" target="_self" rel="nofollow noopener noreferrer"&gt;sanjaybandhniya,&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you show me how to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2020 14:50:45 GMT</pubDate>
    <dc:creator>amenete</dc:creator>
    <dc:date>2020-10-28T14:50:45Z</dc:date>
    <item>
      <title>I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107742#M30329</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to sort the visible task in my-task in descending order of the workflow initiated(I want workflow initiated to be on the top).&lt;/P&gt;&lt;P&gt;Please suggest.Thanks.&lt;/P&gt;&lt;P&gt;Below is the my-task screenshot&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="my-task.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/725i76A4875621DFF8A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 11:30:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107742#M30329</guid>
      <dc:creator>Isha</dc:creator>
      <dc:date>2020-06-29T11:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107743#M30330</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You need to check with the api(webscript) which is returning result.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 05:11:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107743#M30330</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2020-08-04T05:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107744#M30331</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/36939" target="_self" rel="nofollow noopener noreferrer"&gt;sanjaybandhniya,&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you show me how to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:50:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107744#M30331</guid>
      <dc:creator>amenete</dc:creator>
      <dc:date>2020-10-28T14:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107745#M30332</link>
      <description>&lt;P&gt;You need to override TaskInstancesGet webscript.(TaskInstancesGet.java)&lt;BR /&gt;In that file there is a Comparator which is sorting task by DueDate.&lt;BR /&gt;Here you need to change it to as per your scenario.&lt;BR /&gt;Ex.if you want latest created workflow comes first then you need to use ContentModel.PROP_CREATED instead of WorkflowModel.PROP_DUE_DATE.&lt;/P&gt;&lt;P&gt;Below Example willr display task by latest.&lt;/P&gt;&lt;PRE&gt; class WorkflowTaskDueAscComparator implements Comparator&amp;lt;WorkflowTask&amp;gt;
    {
        @Override
        public int compare(WorkflowTask o1, WorkflowTask o2)
        {

        	Date date1 = (Date)o1.getProperties().get(ContentModel.PROP_CREATED);
            Date date2 = (Date)o2.getProperties().get(ContentModel.PROP_CREATED);
            
            long time1 = date1 == null ? Long.MAX_VALUE : date1.getTime();
            long time2 = date2 == null ? Long.MAX_VALUE : date2.getTime();
            
            
           return time1&amp;gt;time2?-1:1;
        }
        
    }&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 05:30:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107745#M30332</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2020-10-29T05:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107746#M30333</link>
      <description>&lt;P&gt;I have created a java file named TaskInstancesGet.java at location and changed the parameters:--&amp;gt; D:\dms\tomcat\webapps\alfresco\WEB-INF\classes\org\alfresco\repo\web\scripts\workflow but then also it is not working.&lt;/P&gt;&lt;P&gt;package org.alfresco.repo.web.scripts.workflow;&lt;/P&gt;&lt;P&gt;import java.util.ArrayList;&lt;BR /&gt;import java.util.Arrays;&lt;BR /&gt;import java.util.Collections;&lt;BR /&gt;import java.util.Comparator;&lt;BR /&gt;import java.util.Date;&lt;BR /&gt;import java.util.HashMap;&lt;BR /&gt;import java.util.List;&lt;BR /&gt;import java.util.Map;&lt;/P&gt;&lt;P&gt;import javax.servlet.http.HttpServletResponse;&lt;/P&gt;&lt;P&gt;import org.alfresco.repo.workflow.WorkflowModel;&lt;BR /&gt;import org.alfresco.service.cmr.workflow.WorkflowTask;&lt;BR /&gt;import org.alfresco.service.cmr.workflow.WorkflowTaskQuery;&lt;BR /&gt;import org.alfresco.service.cmr.workflow.WorkflowTaskQuery.OrderBy;&lt;BR /&gt;import org.alfresco.service.cmr.workflow.WorkflowTaskState;&lt;BR /&gt;import org.alfresco.util.ModelUtil;&lt;BR /&gt;import org.springframework.extensions.webscripts.Cache;&lt;BR /&gt;import org.springframework.extensions.webscripts.Status;&lt;BR /&gt;import org.springframework.extensions.webscripts.WebScriptException;&lt;BR /&gt;import org.springframework.extensions.webscripts.WebScriptRequest;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Webscript impelementation to return workflow task instances.&lt;BR /&gt;*&lt;BR /&gt;* @author Nick Smith&lt;BR /&gt;* @author Gavin Cornwell&lt;BR /&gt;* @since 3.4&lt;BR /&gt;*/&lt;BR /&gt;public class TaskInstancesGet extends AbstractWorkflowWebscript&lt;BR /&gt;{&lt;BR /&gt;public static final String PARAM_AUTHORITY = "authority";&lt;BR /&gt;public static final String PARAM_STATE = "state";&lt;BR /&gt;public static final String PARAM_PRIORITY = "priority";&lt;BR /&gt;public static final String PARAM_DUE_BEFORE = "dueBefore";&lt;BR /&gt;public static final String PARAM_DUE_AFTER = "dueAfter";&lt;BR /&gt;public static final String PARAM_PROPERTIES = "properties";&lt;BR /&gt;public static final String PARAM_POOLED_TASKS = "pooledTasks";&lt;BR /&gt;public static final String VAR_WORKFLOW_INSTANCE_ID = "workflow_instance_id";&lt;/P&gt;&lt;P&gt;private WorkflowTaskDueAscComparator taskComparator = new WorkflowTaskDueAscComparator();&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/33527"&gt;@override&lt;/A&gt;&lt;BR /&gt;protected Map&amp;lt;String, Object&amp;gt; buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)&lt;BR /&gt;{&lt;BR /&gt;Map&amp;lt;String, String&amp;gt; params = req.getServiceMatch().getTemplateVars();&lt;BR /&gt;Map&amp;lt;String, Object&amp;gt; filters = new HashMap&amp;lt;String, Object&amp;gt;(4);&lt;/P&gt;&lt;P&gt;// authority is not included into filters list as it will be taken into account before filtering&lt;BR /&gt;String authority = getAuthority(req);&lt;BR /&gt;&lt;BR /&gt;if (authority == null)&lt;BR /&gt;{&lt;BR /&gt;// ALF-11036 fix, if authority argument is omitted the tasks for the current user should be returned.&lt;BR /&gt;authority = authenticationService.getCurrentUserName();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// state is also not included into filters list, for the same reason&lt;BR /&gt;WorkflowTaskState state = getState(req);&lt;BR /&gt;&lt;BR /&gt;// look for a workflow instance id&lt;BR /&gt;String workflowInstanceId = params.get(VAR_WORKFLOW_INSTANCE_ID);&lt;BR /&gt;&lt;BR /&gt;// determine if pooledTasks should be included, when appropriate i.e. when an authority is supplied&lt;BR /&gt;Boolean pooledTasksOnly = getPooledTasks(req);&lt;BR /&gt;&lt;BR /&gt;// get list of properties to include in the response&lt;BR /&gt;List&amp;lt;String&amp;gt; properties = getProperties(req);&lt;BR /&gt;&lt;BR /&gt;// get filter param values&lt;BR /&gt;filters.put(PARAM_PRIORITY, req.getParameter(PARAM_PRIORITY));&lt;BR /&gt;processDateFilter(req, PARAM_DUE_BEFORE, filters);&lt;BR /&gt;processDateFilter(req, PARAM_DUE_AFTER, filters);&lt;BR /&gt;&lt;BR /&gt;String excludeParam = req.getParameter(PARAM_EXCLUDE);&lt;BR /&gt;if (excludeParam != null &amp;amp;&amp;amp; excludeParam.length() &amp;gt; 0)&lt;BR /&gt;{&lt;BR /&gt;filters.put(PARAM_EXCLUDE, new ExcludeFilter(excludeParam));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;List&amp;lt;WorkflowTask&amp;gt; allTasks;&lt;/P&gt;&lt;P&gt;if (workflowInstanceId != null)&lt;BR /&gt;{&lt;BR /&gt;// a workflow instance id was provided so query for tasks&lt;BR /&gt;WorkflowTaskQuery taskQuery = new WorkflowTaskQuery();&lt;BR /&gt;taskQuery.setActive(null);&lt;BR /&gt;taskQuery.setProcessId(workflowInstanceId);&lt;BR /&gt;taskQuery.setTaskState(state);&lt;BR /&gt;taskQuery.setOrderBy(new OrderBy[]{OrderBy.TaskDue_Asc});&lt;BR /&gt;&lt;BR /&gt;if (authority != null)&lt;BR /&gt;{&lt;BR /&gt;taskQuery.setActorId(authority);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;allTasks = workflowService.queryTasks(taskQuery);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// default task state to IN_PROGRESS if not supplied&lt;BR /&gt;if (state == null)&lt;BR /&gt;{&lt;BR /&gt;state = WorkflowTaskState.IN_PROGRESS;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// no workflow instance id is present so get all tasks&lt;BR /&gt;if (authority != null)&lt;BR /&gt;{&lt;BR /&gt;List&amp;lt;WorkflowTask&amp;gt; tasks = workflowService.getAssignedTasks(authority, state, true);&lt;BR /&gt;List&amp;lt;WorkflowTask&amp;gt; pooledTasks = workflowService.getPooledTasks(authority, true);&lt;BR /&gt;if (pooledTasksOnly != null)&lt;BR /&gt;{&lt;BR /&gt;if (pooledTasksOnly.booleanValue())&lt;BR /&gt;{&lt;BR /&gt;// only return pooled tasks the user can claim&lt;BR /&gt;allTasks = new ArrayList&amp;lt;WorkflowTask&amp;gt;(pooledTasks.size());&lt;BR /&gt;allTasks.addAll(pooledTasks);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// only return tasks assigned to the user&lt;BR /&gt;allTasks = new ArrayList&amp;lt;WorkflowTask&amp;gt;(tasks.size());&lt;BR /&gt;allTasks.addAll(tasks);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// include both assigned and unassigned tasks&lt;BR /&gt;allTasks = new ArrayList&amp;lt;WorkflowTask&amp;gt;(tasks.size() + pooledTasks.size());&lt;BR /&gt;allTasks.addAll(tasks);&lt;BR /&gt;allTasks.addAll(pooledTasks);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// sort tasks by due date&lt;BR /&gt;Collections.sort(allTasks, taskComparator);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;// authority was not provided -&amp;gt; return all active tasks in the system&lt;BR /&gt;WorkflowTaskQuery taskQuery = new WorkflowTaskQuery();&lt;BR /&gt;taskQuery.setTaskState(state);&lt;BR /&gt;taskQuery.setActive(null);&lt;BR /&gt;taskQuery.setOrderBy(new OrderBy[] { OrderBy.TaskDue_Asc });&lt;BR /&gt;allTasks = workflowService.queryTasks(taskQuery);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int maxItems = getIntParameter(req, PARAM_MAX_ITEMS, DEFAULT_MAX_ITEMS);&lt;BR /&gt;int skipCount = getIntParameter(req, PARAM_SKIP_COUNT, DEFAULT_SKIP_COUNT);&lt;BR /&gt;int totalCount = 0;&lt;BR /&gt;ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; results = new ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;();&lt;BR /&gt;&lt;BR /&gt;// Filter results&lt;BR /&gt;WorkflowTask task = null;&lt;BR /&gt;for(int i=0; i&amp;lt;allTasks.size(); i++)&lt;BR /&gt;{&lt;BR /&gt;task = allTasks.get(i);&lt;BR /&gt;if (matches(task, filters))&lt;BR /&gt;{&lt;BR /&gt;// Total-count needs to be based on matching tasks only, so we can't just use allTasks.size() for this&lt;BR /&gt;totalCount++;&lt;BR /&gt;if(totalCount &amp;gt; skipCount &amp;amp;&amp;amp; (maxItems &amp;lt; 0 || maxItems &amp;gt; results.size()))&lt;BR /&gt;{&lt;BR /&gt;// Only build the actual detail if it's in the range of items we need. This will&lt;BR /&gt;// drastically improve performance over paging after building the model&lt;BR /&gt;results.add(modelBuilder.buildSimple(task, properties));&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Map&amp;lt;String, Object&amp;gt; model = new HashMap&amp;lt;String, Object&amp;gt;();&lt;BR /&gt;model.put("taskInstances", results);&lt;BR /&gt;&lt;BR /&gt;if (maxItems != DEFAULT_MAX_ITEMS || skipCount != DEFAULT_SKIP_COUNT)&lt;BR /&gt;{&lt;BR /&gt;// maxItems or skipCount parameter was provided so we need to include paging into response&lt;BR /&gt;model.put("paging", ModelUtil.buildPaging(totalCount, maxItems == DEFAULT_MAX_ITEMS ? totalCount : maxItems, skipCount));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// create and return results, paginated if necessary&lt;BR /&gt;return model;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Retrieves the list of property names to include in the response.&lt;BR /&gt;*&lt;BR /&gt;* @param req The WebScript request&lt;BR /&gt;* @return List of property names&lt;BR /&gt;*/&lt;BR /&gt;private List&amp;lt;String&amp;gt; getProperties(WebScriptRequest req)&lt;BR /&gt;{&lt;BR /&gt;String propertiesStr = req.getParameter(PARAM_PROPERTIES);&lt;BR /&gt;if (propertiesStr != null)&lt;BR /&gt;{&lt;BR /&gt;return Arrays.asList(propertiesStr.split(","));&lt;BR /&gt;}&lt;BR /&gt;return null;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/**&lt;BR /&gt;* Retrieves the pooledTasks parameter.&lt;BR /&gt;*&lt;BR /&gt;* @param req The WebScript request&lt;BR /&gt;* @return null if not present, Boolean object otherwise&lt;BR /&gt;*/&lt;BR /&gt;private Boolean getPooledTasks(WebScriptRequest req)&lt;BR /&gt;{&lt;BR /&gt;Boolean result = null;&lt;BR /&gt;String includePooledTasks = req.getParameter(PARAM_POOLED_TASKS);&lt;BR /&gt;&lt;BR /&gt;if (includePooledTasks != null)&lt;BR /&gt;{&lt;BR /&gt;result = Boolean.valueOf(includePooledTasks);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return result;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/**&lt;BR /&gt;* Gets the specified {@link WorkflowTaskState}, null if not requested&lt;BR /&gt;*&lt;BR /&gt;* @param req&lt;BR /&gt;* @return&lt;BR /&gt;*/&lt;BR /&gt;private WorkflowTaskState getState(WebScriptRequest req)&lt;BR /&gt;{&lt;BR /&gt;String stateName = req.getParameter(PARAM_STATE);&lt;BR /&gt;if (stateName != null)&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;return WorkflowTaskState.valueOf(stateName.toUpperCase());&lt;BR /&gt;}&lt;BR /&gt;catch (IllegalArgumentException e)&lt;BR /&gt;{&lt;BR /&gt;String msg = "Unrecognised State parameter: " + stateName;&lt;BR /&gt;throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return null;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Returns the specified authority. If no authority is specified then returns the current Fully Authenticated user.&lt;BR /&gt;* @param req&lt;BR /&gt;* @return&lt;BR /&gt;*/&lt;BR /&gt;private String getAuthority(WebScriptRequest req)&lt;BR /&gt;{&lt;BR /&gt;String authority = req.getParameter(PARAM_AUTHORITY);&lt;BR /&gt;if (authority == null || authority.length() == 0)&lt;BR /&gt;{&lt;BR /&gt;authority = null;&lt;BR /&gt;}&lt;BR /&gt;return authority;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Determine if the given task should be included in the response.&lt;BR /&gt;*&lt;BR /&gt;* @param task The task to check&lt;BR /&gt;* @param filters The list of filters the task must match to be included&lt;BR /&gt;* @return true if the task matches and should therefore be returned&lt;BR /&gt;*/&lt;BR /&gt;private boolean matches(WorkflowTask task, Map&amp;lt;String, Object&amp;gt; filters)&lt;BR /&gt;{&lt;BR /&gt;// by default we assume that workflow task should be included&lt;BR /&gt;boolean result = true;&lt;/P&gt;&lt;P&gt;for (String key : filters.keySet())&lt;BR /&gt;{&lt;BR /&gt;Object filterValue = filters.get(key);&lt;/P&gt;&lt;P&gt;// skip null filters (null value means that filter was not specified)&lt;BR /&gt;if (filterValue != null)&lt;BR /&gt;{&lt;BR /&gt;if (key.equals(PARAM_EXCLUDE))&lt;BR /&gt;{&lt;BR /&gt;ExcludeFilter excludeFilter = (ExcludeFilter)filterValue;&lt;BR /&gt;String type = task.getDefinition().getMetadata().getName().toPrefixString(this.namespaceService);&lt;BR /&gt;if (excludeFilter.isMatch(type))&lt;BR /&gt;{&lt;BR /&gt;result = false;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else if (key.equals(PARAM_DUE_BEFORE))&lt;BR /&gt;{&lt;BR /&gt;Date dueDate = (Date)task.getProperties().get(WorkflowModel.PROP_DUE_DATE);&lt;/P&gt;&lt;P&gt;if (!isDateMatchForFilter(dueDate, filterValue, true))&lt;BR /&gt;{&lt;BR /&gt;result = false;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else if (key.equals(PARAM_DUE_AFTER))&lt;BR /&gt;{&lt;BR /&gt;Date dueDate = (Date)task.getProperties().get(WorkflowModel.PROP_DUE_DATE);&lt;/P&gt;&lt;P&gt;if (!isDateMatchForFilter(dueDate, filterValue, false))&lt;BR /&gt;{&lt;BR /&gt;result = false;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else if (key.equals(PARAM_PRIORITY))&lt;BR /&gt;{&lt;BR /&gt;if (!filterValue.equals(task.getProperties().get(WorkflowModel.PROP_PRIORITY).toString()))&lt;BR /&gt;{&lt;BR /&gt;result = false;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return result;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/**&lt;BR /&gt;* Comparator to sort workflow tasks by due date in ascending order.&lt;BR /&gt;*/&lt;BR /&gt;class WorkflowTaskDueAscComparator implements Comparator&amp;lt;WorkflowTask&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/33527"&gt;@override&lt;/A&gt;&lt;BR /&gt;public int compare(WorkflowTask o1, WorkflowTask o2)&lt;BR /&gt;{&lt;BR /&gt;Date date1 = (Date)o1.getProperties().get(ContentModel.PROP_CREATED);&lt;BR /&gt;Date date2 = (Date)o2.getProperties().get(ContentModel.PROP_CREATED);&lt;BR /&gt;&lt;BR /&gt;long time1 = date1 == null ? Long.MAX_VALUE : date1.getTime();&lt;BR /&gt;long time2 = date2 == null ? Long.MAX_VALUE : date2.getTime();&lt;BR /&gt;&lt;BR /&gt;long result = time1 - time2;&lt;BR /&gt;&lt;BR /&gt;return (result &amp;gt; 0) ? 1 : (result &amp;lt; 0 ? -1 : 0);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;How to do that as&amp;nbsp; i tried to create class file also of&amp;nbsp;TaskInstancesGet but unfortunately it is giving error. Can anyone share the class file as well as tell me at what location we need to change the file ..&lt;/P&gt;&lt;P&gt;Any kind of help will be appreciable.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 12:02:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107746#M30333</guid>
      <dc:creator>akash251998</dc:creator>
      <dc:date>2020-12-14T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: I want to sort my-task in alfresco share</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107747#M30334</link>
      <description>&lt;P&gt;Try to use sdk for customization or modification.&lt;/P&gt;&lt;P&gt;Dont create file at same place.Instead try to override bean of that webscript.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 12:18:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/i-want-to-sort-my-task-in-alfresco-share/m-p/107747#M30334</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2020-12-15T12:18:41Z</dc:date>
    </item>
  </channel>
</rss>

