次の方法で共有


Updating List Item with Task Form Custom Field in SharePoint Approval 2010 Workflow

Objective

I have come across a scenario in which I need to add a custom field in Approval Task Form and then the list item has to be updated with the value entered in custom approval task form field. I want to update the list item only when approver approves the item.

Solution

Let’s see the steps that I have followed

  • Open Site in SharePoint Designer 2010, click Workflows on left side navigation. Right click on Approval - SharePoint 2010 workflow, select Copy and Modify option. Name new copy as Custom Approval Workflow. Select the content type that is used in the SharePoint list. Content Type selection is important as we are updating a specific field through workflow, otherwise custom list fields will not be available in reusable workflows.

  • Click Approval Workflow Task (en-US) Copy. Click New button in Task Form Fields section. Name the field as Bonus Points of Number data type

  • Click on Local Variables in Ribbon. Add a variable name BonusPointsVariable of Number data type

  • Click on Change the behavior of single task link under Customizatoin section. Hover the mouse inside If Current Task:Outcome equals Approved condition under When a Task Compltes section and add Set Workflow Variable action from the ribbon. Assign the local variable (Variable:BonusPointsVariable) with the task form field (Current Task:Bonus Points) as highlighted in the below picture.

  • Navigate back to the Workflow Editor and add a condition - If any value equals value from the ribbon at the end of the Step1
  • Edit If condition to If Variable:IsItemApproved equls Yes

  • Position mouse pointer in the above If condition and add Update List Item action from the ribbon. Set the List Item field - Points with the Local Variable: BonusPointsVariable as shown in the below picture.

  • Save and Pubilsh the workflow.

 

Navigate to List Content Types (List Settings --> Content Types --> Select the content type) and click on Workflow Settings. Add a work flow by selecting the above defined workflow. With this, whenever a approver approves a task (Task will be created for each list item), he can provide Bonus points in the Task Form. List Item will be updated with the approver entered bonus points.

 

Thats all. Hope this is useful.

Regards, Kishore

Comments

  • Anonymous
    June 21, 2012
    value assignment shows only path and name under set this field. The columns in the current list could not be accessed

  • Anonymous
    February 04, 2013
    I have tried this several times and keep getting the same error when trying to add an Approvers group.  The error is a popup that says "The form cannot be submitted because of an error." There's a question on stack exchange that mentions this.... sharepoint.stackexchange.com/.../sharepoint-designer-2010-custom-workflow-does-not-start-in-subsite I don't have that KB item installed and I've tried removing and re-adding the Approvers and CC fields, with no success. Any help?

  • Anonymous
    February 11, 2013
    Hi Shuckle, Follow these steps:

  1. Open site in SP Designer 2010
  2. Navigate to Workflows -> (Your Workflow) -> (Your Workflow).xoml.wfconfig.xml
  3. Right click the xml file and select "edit in advanced mode"
  4. Search for <d:approvers xml tag (It contains To, and CC part for approvers)
  5. Remove nsi;Null (dont' remember exactly) from CC and save. Publish your workflow. Hope that helps.
  • Anonymous
    March 26, 2013
    Good Article! But in my Library, an document needs to be checked out before edit. Is it possible to update a field in the workflow without checking out?

  • Anonymous
    October 28, 2013
    Great article, just what I was looking for. Thank you.

  • Anonymous
    March 27, 2014
    One doubt I have while reading this is, will the workflow get triggered again as the list column gets updated if the workflow is set for item create/change? If yes, how do we prevent it?