This blog will help to add a list item using a HTTP call in SharePoint Designer Workflow.
Create a new Dictionary Variable and name it as “Header” in the “Build” action to store the headers for the Post HTTP call.
Then, click on “this” in the “Build” action, it will show the dictionary variable, while add in the “Header” dictionary variable, it will show another popup to add the dictionary item in it.
We have to add Headers for the Post HTTP call by adding the headers as a dictionary item in the Dictionary. To use the Post HTTP call, add the below headers.
Create a new variable and enter the List
Note: Search as variable and enter, it will “Set Workflow Variable” action, then click on “Workflow Variable” and create a new variable or choose “Set Workflow Variable” from “Action”.
Create a new variable to form the HTTP rest API to add data in a SharePoint list.
Create a dictionary variable and name it as “metadata” and add below data as Dictionary item.
Hit the below URL in the browser, then search it for “ListItemEntityTypeFullName”, then copy the ListItemEntityTypeFullName value for the “type” Dictionary item.
Create a dictionary variable and name it as “Parameters” and add below data as Dictionary item.
|__metadata||Dictionary||/** Select the Workflow Varibale metadata **/|
Then add internal name of the field, its respected field type, and its respected value in the Dictionary item to add item in the SharePoint list.
Once the parameters are stored in a workflow variable, then search “HTTP” and click enter it will show “HTTP Call” action in the stage.
Select the “HTTP Call” action and click “Advanced Properties” from the top navigation bar of the workflow. Once clicked on the “Advanced Properties”, it will show “Call HTTP Web Services Properties” dialog box.
Choose Workflow Variable which is stored Rest API call for Address, “HTTP POST” for Request Type, Workflow Variable which is stored Headers for Request Headers, Workflow Variable which is stored Parameters for Request Content and create a new variable for Request Content and Response Status Code.
To check the error message of the “HTTP Call”, Choose “Get an item from a Dictionary” from Action and paste it “error/message/value” for path and choose workflow variable which assigned for ResponseContent and choose a variable to store the output and log the variable.
To check the “HTTP Call” is executed, log the workflow variable which assigned for Response Status Code.
In the “Transition to Stage”, choose “Go to a Stage” and select “End of Workflow”, then publish the workflow.
I hope, you have learned how to add a list item using SharePoint Designer workflow from the blog.