SharePoint Online – Create/Update Record with MMD Field using SharePoint Designer Workflow and REST API

Workflows help people to collaborate on documents and to manage project tasks by implementing business processes on documents and items in a SharePoint site. Workflows help organizations to adhere to consistent business processes, and they also improve organizational efficiency and productivity by managing the tasks and steps involved in business processes. This enables the people who perform these tasks to concentrate on performing the work rather than managing the workflow.

In the below example I am going to show you how to ADD/UPDATE a sharepoint list item with MMD Column.

Create Item

Step 1 – Create the following variables in the SharePoint Designer 2013 workflow and set the values accordingly


Step 2 – Add Call HTTP Web Service action and configure the same as shown below using the advanced properties


Step 3 – Based on POST Response Code you can perform your action using an If condition

Step 4 – Publish the workflow and test

Update Item

To update an item we have to slightly adjust the EndPointUrl and POST_RequestHeader variables as shown below


Starting SharePoint Site Workflows from code behind

One of the cool new features of  SharePoint 2010 is Site Workflows. As you know, in MOSS 2007 a workflow can only be associated with a list or a document library. While this functionality is useful, sometimes a “site wide” workflow is called for. This leads to us developers getting creative and producing  approaches such as creating a list called “Site Workflows” and creating items in it that have “start on create” workflows attached to them. In SharePoint 2010 Site Workflows provide an elegant solution for this common scenario.

The Code

 using (SPSite site = new SPSite("http://sitename")) //get the site

           using (SPWeb web = site.OpenWeb()) // get the web
                        //find workflow to start
                        var assoc = web.WorkflowAssociations.GetAssociationByName("Workflow Name", CultureInfo.InvariantCulture);

                        //this is the call to start the workflow
                        var result = site.WorkflowManager.StartWorkflow(null, assoc, string.Empty, SPWorkflowRunOptions.Synchronous);


The Helper Class Code to call to start a list workflow

public void runWorkFlows(string strListName, int intCurrentItemID, string strWorkflowName)

using (SPSite objSite = new SPSite(SPContext.Current.Site.Url))
objSite.AllowUnsafeUpdates = true;
using (SPWeb objWeb = objSite.OpenWeb())
objWeb.AllowUnsafeUpdates = true;
SPList list = objWeb.Lists[strListName];
SPListItem lstItem = list.GetItemById(intCurrentItemID);

//obtain an instance of SPWorkflowManager which will be used to start the workflow
SPWorkflowManager manager = objSite.WorkflowManager;

//get all workflows associated with the list
SPWorkflowAssociationCollection associationCol = list.WorkflowAssociations;

//iterate through all the workflow and lookup for the workflow to be started

foreach (SPWorkflowAssociation association in associationCol)
if (association.Name == strWorkflowName)
//get workflow association data
string assData = association.AssociationData;

//start the workflow
manager.StartWorkflow(lstItem, association, assData);

objWeb.AllowUnsafeUpdates = false;
objSite.AllowUnsafeUpdates = false;

As you have noticed, the API call to start a site workflow is not much different form the call to start a list workflow. A new overload was added to SPWorkflowManager.StartWorkflow() method. This is the method we call to programmatically start our site workflow. One new parameter of this overloaded method which deserves a mention is the runOptions parameter, which expects a SPWorkflowRunOptions enumerator. See MSDN page for details.