Updating list items using SharePoint 2013 workflow engine

SharePoint 2013 brings a new workflow engine with several enhancements such as support to REST calls, elastic services and more. The complete list of what is new in SharePoint 2013 workflows can be found here.

One of the most celebrated new feature by the developers is the possibilities to make REST call directly from the workflows. With that, the workflows can be easily integrated with other system and even with other SharePoint sites.  Just a simple search on the internet and you can find several examples illustrating how to call external JSON web services and how to read and write SharePoint lists items using the SharePoint REST API as well. However, update an existing item in a SharePoint lists has some tricks which we will show you in this post.

The approach will be follow the Microsoft operation guide using SharePoint 2013 REST endpoints (link here) and convert it to run on our workflow. Assuming that you know which list you want to update and you already started to create the workflow, here are the steps:

1. Build a dictionary that will contain the headers for the REST call. We willl call this dictionary POST_RequestHeader and add the attributes according to the picture below

SharePoint 2013

Accept: application/json;odata=verbose
content-type: application/json;odata=verbose

According to SharePoint 2013 REST guide,  when you are trying to update an item you do need to use the term X-HTTP-Method in the REST header. Also the header IF-MATCH has to be presented, but whenever you don’t have to worry about concurrency, the value (*) should be uses. Otherwise you should obtain the etag value of a list item by performing a GET request before update the item.

2. Create another dictionary called POST_Metadata where we will store the type of the item

SharePoint 2013

type: SP.Data.<yourdatatype>

You should find the correct data type for the item you are trying to update. One way to find it is creating an item into the list you are trying to edit and query it using the REST API. The URL would look like something like that:


If you are using the browser to open this URL you will see a bunch of XML. Just look for the property Category term=”SP.Data.<yourdatatype>” and you will have the data type. For example, if I am trying to update an item in a list called “Tasks”, my data type will be SP.Data.TasksListItem. The data type name might change so don’t assume it is always your list name.

Previously we talked about the etag value that should be used when you might have concurrency scenario. You can see this value in the m:etag property

TIP: In case you don’t like reading XML you can use some tools to visualize the REST response in a better way. Currently I’ve been using a Google chrome extension called “Advanced REST client” where you can enter your URL and the tool let you specify also some headers for the query. For instance, if you specify the key Accept: application/json;odata=verbose to the REST header you will get the query result in a readable JSON format.

 3. Create another dictionary called POST_Parameters and add the POST_Metadata as parameter as well as the list fields you want to update

SharePoint 2013

__metadata: <POST_Metadata dictionary>
Title: My new updated title (Example of a list field that I am updating)


4. Configure the web service call. When you are configuring the parameters, make sure you are using the properties windows from the “Call HTTP web service” action

SharePoint 2013
“Call HTTP web service”

Address: http://<yourserver>/<yoursite>/_api/web/lists/getByTitle(‘<yourlist>’)/Items(<itemid>)
RequestType: HTTP POST
RequestHeader: POST_RequestHeader
RequestContent: POST_Parameters
ResponseStatusCode: POST_ResponseCode (just a string variable)

Than you should be all set to try it. Don’t forget that this is an UPDATE routine, so the item should exist in a list. If the web service call successfully updates the item, your response code will be the string “NoConten”, otherwise you will have the error message.

Never miss an article by subscribing to our monthly digest!

Article Name
Updating list items using SharePoint 2013 workflow engine
SharePoint 2013 brings a new workflow engine with several enhancements such as support to REST calls, elastic services and more.
Publisher Name
Atos Consulting CH
Publisher Logo

15 thoughts on “Updating list items using SharePoint 2013 workflow engine

  1. Yago auza Reply

    Usualmente no dejo comentarios, pero la verdad que hago una excepción.
    Excelente post, muy útil.

  2. Deepali Jain Reply

    Hi Alexandre,

    Thanks for the great post. I followed your post to update title of a custom list using “CAll HTTP webservice action, but I am getting “Forbidden” error in the log while doing that.
    Do you have any idea, how can we get rid of this error? Or what could I be missing ?

    Thanks & Regards,

  3. Dave Reply

    Thanks for posting this. I followed it and works great in SharePoint Online.

  4. Chris Reply

    This example really helped a lot. I will be featuring it in a blog post soon. Thank you for your help.

    • Devin Reply

      I am also getting ‘forbidden’ error, as responseCode is Forbidden.. Were you able to solve this, anyone have any ideas?

  5. ds Reply

    Did MS miss adding the ability to blank out fields by setting them to null or an empty variable? 🙁

  6. Neil Roy Reply

    Great Post! But I’ve followed all the steps but I am getting BADREQUEST as the output

    • Alexandre Menezes Post authorReply

      Check if all the HEADERS are correct. BadRequest means that the web call is not well formed.

  7. Alexandre Menezes Post authorReply

    Hi All,
    – BADREQUEST errors are normally caused by misspelling on some of the request headers. Make sure you got it right!
    – FORBIDDEN errors are mainly for two causes (1) Permissions on the list. SharePoint REST will respect the permissions on the list. So check if the Account used to execute the API has permissions (2) If you are executing this REST call from an application outside SharePoint, you need a completely different authorization mechanism…

    Hope it helps!

  8. Alan Reply

    Good job. For everyone is important to check the __metadata is a dictionary.

    Also is important to check the permissions on the SharePoint List it caueses that you cant write in another list.

Leave a Reply

Your email address will not be published. Required fields are marked *