Hi
I have developed a flow which is doing what I want - get response details when a new form is submitted, then creating and item and then I'm using a switch which has 15 cases based on the answer to a particular question in the form. Depending on this answer it gets sent to the appropriate people for a first to respond approval and then it updates the item and then sends a notification email to the responders email.
I've got this to work to the point I'm happy with however I've been asked by other uses to have the approvers comments show in the sharepoint list and include them in the email. Now I know how to set those but where I'm running in to trouble is trying to initialize a string. When I try to add it to a case it tells me that a string has to be at top level.
From my googling I think my problem is I can initialize strings when I have the switch/case?
This link - Capture comments from approver - had an easy solution to what I wanted to do but I couldn't make it work.
I also tried a variation of this one - Approval workflow capturing comments from approvers email - but it would error when it got to the Switch.
Hoping somewhere here might be able to provide alternatives? Thank You!!! 😀
Hello @lackinglogic ,
variables can't be initialised inside loops/switches/etc., if you want a variable you must initialise it at a top level, somewhere right after a trigger. Once it's initialised you can use it anywhere in the flow with the 'Set variable' or 'Append to variable' actions.
And if you're interested in more alternatives to capture and display approval comments you can check also my approach. 🙂
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492