I recently changing Akumina’s InterChange to work with SharePoint 2013 SharePoint Designer workflow but ran into issue that I cannot update the content approval status (_ModerationStatus field) via Designer workflow using builtin update list item activity. Here is the step-by-step instruction to update content approval status from SharePoint Designer workflow using CallHTTP activity.
- Activate “Workflows can use app permissions” from Site Collection –>Site Settings–>Site Actions–>Manage Site Features
- Go to Site Collection –>Site Settings–>Users and Permissions then click Site app permissions and then copy the GUID from workflow
- Go to site Collection URL ~/_layouts/15/appInv.aspx complete the following values
- AppId: value copied from above step
- Title: workflow
- AppDomain: yourdomain (or machinename)
- Redirect URL: http://YourDomain (or http://<machinename>)
- Permission Request XML:
<AppPermissionRequests><AppPermissionRequest Scope=”http://sharepoint/content/sitecollection/web” Right=”FullControl” /></AppPermissionRequests>
- Click Create. You will be promted with dialog. Click Trust it
- Launch the SharePoint Designer and Create a List Workflow (Same applicable for Reusable or Site Workflow)
- From the designer action drop the Build Dictionary Activity and name id “ApprovalRequestHeader” add the following fields
Name Type Value accept String application/json;odata=verbose content-type String application/json;odata=verbose X-HTTP-Method String MERGE IF-MATCH String * - From the designer action drop the Build Dictionary Activity and name id “RequestApprovalMetadata” add the following fields. Note that Approval Required field must be turned on for this value to appear
Name Type Value type String SP.Data.<LISTNAME>ListItem You can get this value by browsing to http://<yoursite>/ _api/web/lists
The value should be from listitementitypefullname
Build Metadata Dictionary
- From the designer action drop the Build Dictionary Activity and name id “RequestApprovalParam” add the following fields
Name Type Value __metadata Dictionary Variable: ApprovalMetadata Refer to workflow parameters named ApprovalMetadata created in previous step
OData__ModerationStatus Integer 0You can get the field type/name by browsing http://<yoursite>/_api/web/lists/getbyTitle(‘<LISTNAME>’)/items - From the designer action drop the CallHTTP activity and set the properties
- Publish the workflow
- To package and deploy https://msdn.microsoft.com/en-us/library/office/jj819316.aspx