cancel
Showing results for 
Search instead for 
Did you mean: 
darogael

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. 

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/