cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lavint
Helper I
Helper I

Easiest workaround to change Flow trigger from created to created/modified

Hi,

 

I have created this huge flow for a SharePoint list but turns out it will be better off if the trigger is "When an item is created or modified" instead of just created. I read some articles and it said I will have to create from scratch.. Do anyone has any idea to work around this? 

 

The logic is when an item is created but start approval button is not checked, set status to "Draft Saved" and don't do the rest of the flow. When user comes back and modify the item and check the start approval box, set status to Pending and start the rest of the flow.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @lavint there is a way of doing it without recreating the whole Flow, but I'm not going to lie it can be a bit of a faff. I've done this in the past (after doing some work with Logic Apps) and it's worked, but I've not done it on anything overly complex. Ensure that you back up your Flow before trying this.

 

The way I have achieved what you've done here, is by exporting the Flow as a zip file. You can do this from the summary screen and export Package (.zip). Once downloaded, open the zip file and navigate down each level of folder until you find the definition file. Copy this out of your zip file and open in your favourte text editor (I used VSCode). The JSON which you're presented with is all on one line by default, so I usually use an online formatter to make it easier to read.

 

Look for the "triggers" node of the JSON file. To start with the trigger will display "When_an_item_is_created" unless you've changed the name. For clarity, I changed this to "When_an_item_is_created_or_modified". Then towards the end of the triggers node, there is a "path" property. All of this will remain, except for the very last element of the URI which needs to change from "onnewitems" to "onupdateditems".

 

Once you have done that, save your changes and copy your file back into the zip file.

 

Now, return to your Flow home screen and select Import, and use the update options to update your Flow. Then once it has imported, open your Flow and your trigger will have changed.

 

If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365

 

View solution in original post

3 REPLIES 3

Hi @lavint there is a way of doing it without recreating the whole Flow, but I'm not going to lie it can be a bit of a faff. I've done this in the past (after doing some work with Logic Apps) and it's worked, but I've not done it on anything overly complex. Ensure that you back up your Flow before trying this.

 

The way I have achieved what you've done here, is by exporting the Flow as a zip file. You can do this from the summary screen and export Package (.zip). Once downloaded, open the zip file and navigate down each level of folder until you find the definition file. Copy this out of your zip file and open in your favourte text editor (I used VSCode). The JSON which you're presented with is all on one line by default, so I usually use an online formatter to make it easier to read.

 

Look for the "triggers" node of the JSON file. To start with the trigger will display "When_an_item_is_created" unless you've changed the name. For clarity, I changed this to "When_an_item_is_created_or_modified". Then towards the end of the triggers node, there is a "path" property. All of this will remain, except for the very last element of the URI which needs to change from "onnewitems" to "onupdateditems".

 

Once you have done that, save your changes and copy your file back into the zip file.

 

Now, return to your Flow home screen and select Import, and use the update options to update your Flow. Then once it has imported, open your Flow and your trigger will have changed.

 

If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365

 

View solution in original post

lavint
Helper I
Helper I

I will give it a try. Thanks!

If you run into any issues, let me know 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,305)