1

Environment: I have a SharePoint 2013 workflow (built from scratch in SPD) that creates a task using the "Workflow Task (SharePoint 2013)" content type on a custom task list in a Community site. The WF assigns the task to a SP group with a handful of users in it. There are 2 Content Types associated with this task list: "Workflow Task (SharePoint 2013)" and "Task".

Problem: When a member of the group goes to view or edit the task, they do not have the "Claim Release" button under Actions.

Additional Info: When creating a task manually on the same task list (using either content type), there is still no Claim Release button. HOWEVER, when creating a task of either content type on the default "Tasks" list, the button is there (assigned to the same group). I created a brand new task list from the standard "Tasks" app and added tasks under both content types but none of them had the button. I compared the settings between my task lists & the default "Tasks" one & they all match. As far as I can tell, this functionality is not tied to the content type. NOTE: I have not modified ANY of the forms for this list.

Question: What in the world determines whether or not the Claim Release button shows on a task item (aside from it being assigned to a group)? Is there a setting I'm missing or is it something deeper?

At this point, my team & I are stumped and greatly appreciate any assistance provided...

Thank you in advance!

  • So after a ton of extensive testing, it appears that the 'Claim Release' button is not available on a custom task list. I cannot find anything online to support this idea... Can anyone confirm this? Also, if this is the case, is there any way to get similar functionality added to the custom task lists? – Kyle S. Mar 3 '16 at 19:47
0

I got the same issue, in a certain moment a Claim Button has disappeared from the toolbar. There are some other similar questions about this functionality, but they are not answered.

So, I do some research, and find several intresting points.

When Claim Release Button work

For Claim Release Button is responding ClaimReleaseTaskButton class, which is located in Microsoft.SharePoint.dll. Visibility of the button is controlled by private field ButtonMode of type:

private enum CRButtonMode
{
  Claim,
  Release,
  Hidden,
  Uninitialized,
}

To set value of this field in class called method

private ClaimReleaseTaskButton.CRButtonMode GetMode(SPControlMode mode, SPList l, SPListItem li, SPUser user)
{
  if (mode != SPControlMode.Display && mode != SPControlMode.Edit || (l.BaseTemplate != SPListTemplateType.Tasks || li == null) || (li.IsNew || !li.DoesUserHavePermissionsForUI(SPBasePermissions.EditListItems)) || li.Fields.GetFieldById(SPBuiltInFieldId.Completed, false) is SPFieldBoolean && li[SPBuiltInFieldId.Completed] != null && (bool) li[SPBuiltInFieldId.Completed])
    return ClaimReleaseTaskButton.CRButtonMode.Hidden;
  SPFieldLookup field1 = li.Fields.GetField("TaskGroup", false) as SPFieldLookup;
  if (field1 == null || field1.AllowMultipleValues || li["TaskGroup"] == null)
    return ClaimReleaseTaskButton.CRButtonMode.Hidden;
  SPFieldLookup field2 = li.Fields.GetField("AssignedTo", false) as SPFieldLookup;
  if (field2 == null || field2.AllowMultipleValues)
    return ClaimReleaseTaskButton.CRButtonMode.Hidden;
  if (this.IsTaskAssignedToMyGroup(li))
    return ClaimReleaseTaskButton.CRButtonMode.Claim;
  return new SPFieldLookupValue((string) li["AssignedTo"]).LookupId == user.ID ? ClaimReleaseTaskButton.CRButtonMode.Release : ClaimReleaseTaskButton.CRButtonMode.Hidden;
}

So, let's sum up when the button will be hidden:

  • When form not in Display or Edit mode
  • List template not a Tasks (!) list or list item is null
  • Item is new or user does not have edit permission
  • Item has Complete field and value of this field is true
  • (!) Item does not have TaskGroup field, or it value is null or type of value Multiple
  • (!) Item does not have AssignedTo field or type of value Multiple
  • Item claimed by somebody else

Now, let's speek about what does Tasks list mean. SharePoint 2013 has two different tasks list templates:

  1. List template Tasks with id 107.
    It is hidden and cannot be created in UI or in SPD. But it's created when you use option New tasks list in workflow settings page.
  2. List template Hierarchy with id 171.
    This lists is created by standart Tasks app

Claim Release Buttom work only with first type of lists.

How to achive similar funcionality

Main logic of button is pretty simple. When it clicked, private function DoClaimOrRelease check current ButtonMode and depending on this value assign to AssignedTo field value of CurrentUser or TaskGroup field.

After that, method do important check: if list item content type is child of workflow task content type then called SPWorkflowTask.AlterTask(...) method, othewise called item.Update() method.

Other questions

While research, I don't find in Microsoft.SharePoint.dll code when TaskGroup first time get its value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.