cancel
Showing results for 
Search instead for 
Did you mean: 

How 'Set Variable' can be used as a replacement for 'Set Field in Current Item'

Introduction

 

Anyone who has used SharePoint Designer to build 2010 or 2013 workflows is familiar with the 'Set Field in Current Item' action. You might also know that this action is currently not available in Flow. Update item is the only action close enough to achieve the task, however, for every Update Item step in Flow a version is created for that list item. Hence if you do need a 'Set Field in Current Item' action, especially while migrating your SharePoint Designer workflows to Flow then you can consider using the Set Variable action instead. This blog walks you how you can use this action using a demo.

 

picture1.png

 


Brief overview video


This video demonstrates how the Set Field in Current Item works. It also demonstrates how extra versions are created if you only use Flow's Update Item SharePoint action.

 

 

SharePoint list


For this blog, two separate SharePoint lists have been created. One to run the SharePoint Designer workflows and the other for Flow.
Here are some screenshots of the SharePoint list and columnspicture2.png

 

picture3.png

 

picture4.png

 

picture5.png

 

picture6.png

 

SharePoint Designer workflow

 

Even though this blog primarily focuses on building the Flow, here is a screenshot of the workflow using SharePoint Designer. As you will see in the video, this workflow will create two versions for a list item. Our goal is to create a Flow which will also have only two versions.

picture7.png

 

Flow

 

In Flow look for the 'When an item is created' SharePoint Flow template.

 

picture8.png

 Then populate the SharePoint site URL after which select your list name.

 

picture9.png

  

Now we'll initialize the variable. Initialize simple means assign i.e. prior to using a variable we need to create one. In this demo we will assign two variables, one for the 'Registration Date' and the other for 'Status'.

 

Click on 'Add an action'

 

picture10.png

 

Type in 'variable' and select 'Variables - Initialize variable'.  For this demo we'll have to do this twice.

 

picture11.png

 

 Following are the two variables created. For the Date and time type format we have used the String format

 

picture12.png

 

The remaining actions can be set however you see fit for your Flow. In this demo, we're testing to see if the Registration Date and the Status fields are blank. If they are then fill them with values. The Registration date variable is filled using the utcNow() expression which returns the current timestamp as a string. The Status var is filled with a manual text entry 'Registered'. Here are some screenshots

 

picture13.png

 

picture14.png

 

Finally, you can add the Update Item action. As you can see below, the variables are used to updated the list item.

 

picture15.png

 

Conclusion


Adding Update Items steps can be laborious since you have fill in your SharePoint Site URL and select the List name every single time. With the instructions provided in the blog you have to do this only once. If you still think the 'Set Field in Current Item' is required then feel free to vote for my request I had submitted in the Flow community. Here's the link.

Comments

Nice, for clear this Microsoft Flow tips.

by Blog with Movie. 

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of https://plumsail.com, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • Solution Architect with Slalom, and organizer of the Boston Office 365 User Group, and long term SharePoint/Office 365 veteren. Find more at http://www.davidlozzi.com. Follow @DavidLozzi
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc ( https://triad.co.uk)
>