“I’d like to change the SP item trigger to file trigger, but it’s breaking the whole flow, what’s the best approach in Power Automate?”
When building a flow, you should always make sure that you start from the right trigger. There’re only a few things more painful than realising you need the ‘created or modified’ trigger and not just ‘created’. Or that you prepared a flow for a SharePoint list, but in the end it should run on a document library…
Once you delete the trigger, it’ll remove all references to the trigger output. All of them. And the designer obviously won’t like it. You’ll see a ton of flow errors you must fix before you can even save it! Is there some better way than to reference it all over again?
Copy / paste the remaining flow
It’s important to realise that even dynamic contents – the references to other actions – are just expressions. The designer makes it easier by showing them in a list, but it’s an expression on the background. That means it doesn’t matter whether it’s referencing the current trigger or another one, trigger output is trigger output.
The problem is only that the references are removed with the trigger and you must add them back. Something that’s quite easily solved.
If you’re building flows that deal with errors, as explained in the previous article, you should have the whole flow in a scope. As such it can be copied and pasted back, including the references.
Copy the scope with the flow and save it in some code editor, e.g. Visual Studio Code.
Remove the trigger and add the new one.
Delete the Scope with the flow, it lost the references to the trigger anyway…
…and add back the scope from the clipboard/the code editor. This one will contain the references to the trigger and you don’t have to add anything. As long as the trigger output has the same properties you’re fine.
IMPORTANT: Make sure that you really have backup of the flow in a clipboard/code editor, don’t just delete it!
Summary
Changing the trigger in your Power Automate flow is a very risky task as such change is often breaking the whole flow. It removes the dynamic contents and it’s up to you to find all the places where it’s needed, even the ones designer doesn’t warn you about. It’s time consuming, and there’s a high risk that you miss a place or forget what expression was used.
That’s why it’s better to “backup” the flow in a clipboard. The references are just other expressions, and as long as the trigger output has the same properties, most of the references will stay in place. There isn’t much that requires manual fixing, especially if you build universal flows with a bunch of http requests.