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.
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 columns
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.
Flow
In Flow look for the 'When an item is created' SharePoint Flow template.
Then populate the SharePoint site URL after which select your list name.
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'
Type in 'variable' and select 'Variables - Initialize variable'. For this demo we'll have to do this twice.
Following are the two variables created. For the Date and time type format we have used the String format
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
Finally, you can add the Update Item action. As you can see below, the variables are used to updated the list item.
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.