cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

How do you change the initial trigger in a flow?

I created a flow based on a trigger if an item was added or modified from a sharepoint list.  I want to change this to just if one particular field is modified, but i don't know how to do that.  Is the only way to rebuild the flow from scratch?

17 REPLIES 17
Highlighted
Continued Contributor
Continued Contributor

Re: How do you change the initial trigger in a flow?

1. You can change the trigger by deleting the original trigger and then simply adding a different one. Complicating this procedure is the fact that you can't delete the trigger if any other components are using fields from it. So, if you had an email action that used fields from the trigger, you'd have to remove those fields from the email before getting rid of the trigger.

 

2. There is no trigger to start a flow from modifying a particular field of a list. The old way of doing this is to have an extra field to store the older value, and then compare them. For example, if your field is "status", create a new field called "status_old". The flow would fire for every list change, and would compare those values. If the values were different, then it should proceed on, doing whatever it needed to do, and then update status_old with the current value in status.

Highlighted
New Member

Re: How do you change the initial trigger in a flow?

So basically, you would have to remove everything in the flow in order to remove the first trigger - essentially rebuilding it.

I've accidentally created a loop by having the trigger be create or modify an item at the end of my flow I have it update to Yes, if an item is approved - hence triggering another round of emails.  I really need it to be if it is just changing one field.  Doesn't sound like the old way would work for me anymore since the trigger is modifying a list.  I guess I'll just turn off the flow to do a manual update for now.  Thanks for your input!

Highlighted
Advocate III
Advocate III

Re: How do you change the initial trigger in a flow?

in my case i had a long & complex workflow i din't want to recreate from scratch - especially since MS Flow kept complaining about dependencies between the trigger & actions that i could not find when i tried to remove the original trigger

 

so i found this workaround

  • export the workflow as a zip package (option "create as new")
  • make sure to rename the original workflow to avoid conflicts when importing
  • unzip the package file, look for the definition.json file
  • replace the trigger by editing the file:
    in case of a different trigger on the same connection it is rather straightforward, in my case i replaced "When_an_item_is_created" with "When_an_item_is_created_or_modified" , "GetOnNewItems" with "GetOnUpdatedItems" and "onnewitems" with "onupdateditems"
  • recreate the zipfile (make sure the Microsoft.Flow folder is in the root of the zip file)
  • reimport the package, the flow is now triggered by the new action

 

in case you have a different datasource the edit may be more complex, just create 2 small workflows, one with each trigger, export them and look for the differences in their JSON files to help you in the right direction

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: How do you change the initial trigger in a flow?

Hi Ch2017,

 

that is a great idea, just got the problem, that i can not export a package ....

 

image.png

 

Actually i do not understand why as I am logged in with my Admin Account with an e3 License. 

Is there an requirement for a special License?

 

 

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: How do you change the initial trigger in a flow?

Highlighted
Advocate III
Advocate III

Re: How do you change the initial trigger in a flow?

in terms of license there is no reason you are not able to export

Highlighted
Frequent Visitor

Re: How do you change the initial trigger in a flow?

This doesn't seem to work.  When I change "When_a_file_is_created_or_modified_(properties_only)" to "When_a_file_is_created_(properties_only)" I get an unknown error on import.

Highlighted
Regular Visitor

Re: How do you change the initial trigger in a flow?

I have the same issue. When I try to import the package it just says "Something wnet wrong. Please try again later." Have you found a solution?

Highlighted
Advocate III
Advocate III

Re: How do you change the initial trigger in a flow?

this still works, just tested the change from "when item is created" to "when item is created or updated", no problem to import and use the edited version, there is also no reason that it would'n work as the JSON implementation is the same as two years ago

i have the same error when i forget to put the Microsoft.Flow at the root of the ZIP, so check that requirement

Highlighted
Frequent Visitor

Re: How do you change the initial trigger in a flow?

Is there some missing hidden step? I've literally done nothing more than extract the zip, change the single line, and rezipped directory.
Highlighted
Advocate III
Advocate III

Re: How do you change the initial trigger in a flow?

if you drop the exports (original and modified version) somewhere to download i can check what is wrong, be aware that some files may contain usernames so maybe remove them first

Highlighted
Frequent Visitor

Re: How do you change the initial trigger in a flow?

@ch2017  please how do i put Microsoft.Flow at the root of the ZIP

Highlighted
Advocate III
Advocate III

Re: How do you change the initial trigger in a flow?

just create a subfolder called Microsoft.Flow and ZIP the parent folder to match the folder structure of the export file

Highlighted
Dual Super User III
Dual Super User III

Re: How do you change the initial trigger in a flow?

Posted by mistake


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
New Member

Re: How do you change the initial trigger in a flow?

Another workaround can be this:

create a dummy condition like 1=1 and put all your code into this condition(works as a wrapper, I don't know a better way of making a wrapper for your code,  there should be though), then copy it to the clipboard and paste it into a new flow that you created with the right trigger that you fancy. you need to fix the input of the actions that use the trigger output at the end, and tada!

Highlighted
New Member

Re: How do you change the initial trigger in a flow?

an easier workaround is to copy the actions to clipboard and paste them into the new flow that you created with the right trigger. if there are many actions, I can suggest to create a wrapper to contain all your code, I normally do put everything into a always-true condition like 1=1, and this gives me more flexibility to move things around. I just copy the condition to clipboard and then can paste it in any other flow.

Highlighted
Dual Super User III
Dual Super User III

Re: How do you change the initial trigger in a flow?

@Ario 

Good point! An alternate wrapper is 'Scope' action block

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (8,470)