As SharePoint Designer 2016 isn’t going to exist I thought better look into the new Microsoft Flow.

I’ve got a list and every time a status field on a list item is updated I want to create an item in another list.

So i click on the create a flow in my list:

create-a-flow

then I selected the When an existing list item is modified, complete a custom action template. Which is nicely located at the end of the list of available list templates:

select-flow-template

Now I’m ready to add my steps. So first I need to check which field(s) were updated as I only want the Flow to run if a status field was updated to “Generate CVs”

Conditions

Table of Contents

So i add a condition:

Select my status field and type the value of the status:

flow-condition

Ok, this was the easy bit. No real need to add the detailed steps in this article.

HTTP step

Now, I added an HTTP step. When you add the first HTTP step you will not get the Orange outputs ( body, Headers, Status code).

the Http task lets call REST API calls to your flow.

As I want to add a list item, I decided to use REST (https://msdn.microsoft.com/en-us/library/office/dn292552.aspx)

flow-http-2

Then I filled in the Method, Uri, Headers and Body and I got the following warnings:

So in the Uri section of the task I’m getting “Enter a valid uri”

In the Headers section I get: “Enter a valid json”

In the body I’m getting : “Enter a valid json”

So what is the format?

For the heading I needed to add ‘{‘ and ‘}’

{

“accept”: “application/json;odata=verbose”, “content-type”: “application/json;odata=verbose”

}

 

For Body I tried:

{ ‘__metadata’: { ‘type’: ‘SP.Data.TestListItem’ }, ‘Title’: ‘Test’}

This didn’t work. I replaced all the single quotes with double quotes and again my json is valid.

{ “__metadata”: { “type”: “SP.Data.TestListItem”}, “Title”: “Test”}

Ok, so just the Uri field left now. That can’t be difficult, can it?

After a couple of attempts I typed the following url:

https:/ /mytenant.sharepoint.com/sites/BM/bid1/_api/web/lists/GetByTitle(‘CVs’)/items

At first the quotes were invalid as I copied it form a website I got the wrong kind of  single quotes. I replaced these but still no luck.  Still the same “Enter a valid uri”.

Then I recreated my Http step in Flow reentered all the data and now it worked fine. It looks like the Uri is only validated once.

So now I can save my Flow. but when i run my flow I’m finding that i get an alert after a while:

flowerror

Ok, this is good. At least by REST call was made. Now i just need to get my accesstoken issue fixed.

More to follow soon …

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

2 thoughts on “Office 365 – SharePoint Online – Creating list items using Microsoft Flow”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.