Wanted to share an issue I recently ran into, and a quick fix.
By default, all of the outputs you add to a SharePoint 'For a selected item' trigger are required, and there's no method to change the outputs to non-required via the UI. However, if you need a non-required output and you're willing to get into the json, you can change an output to non-required with the following steps:
This makes the fields optional when the end user triggers the Flow.
Just be aware that the 'For a selected item' trigger will not pass any fields that were left blank into the Flow. So, your Flow needs to check for the presence of a field in the trigger output (using a contains()) before attempting to manipulate the field contents.
Thanks for sharing.
It seems that what you shared works perfectly.
I am able to alter the JSON file ok and that works great and I have 3 optional emails now in my flow. I understand what he means when he says "Just be aware that the 'For a selected item' trigger will not pass any fields that were left blank into the Flow." So how do I check that a field doesn't exist in the trigger output? In a condition I have tried:
So bottom line I just need help with figuring out how to tell if the field (in this case email) object is missing from the "For a selected item" object
Anyone have any ideas? Any help will be appreciated
Got the correct syntax from @StevenWade
My expression was too complex I guess, the below worked for me.
He also referenced another article that says this will work:
HTH - Cheers 🙂
Just be aware that you are looking for a literal text string within the trigger body -- @contains() is not JSON aware. That means you need to ensure some uniqueness within your variable names. In your 'email' example, @contains() would return TRUE if someone populated "email', 'email1', or 'email2'; or, if they just used the word 'email' in one of the text responses. Basing your conditional tests on generic variable names may generate errors or unexpected results.
This is a workable hack, and I've used it in several different scenarios. Just make sure you're using unique variable names.