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.
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.