I am not having luck with this flow, despite much help from Copilot and Chat GPT. Time to come to the REAL experts.
I have a SharePoint list with about 150 items. There are THREE columns with one or more Contacts listed (column type: Person or Group).
I need to build a variety of flows to send e-mail notifications to all or a subset of people in these columns.
Steps I have taken that make logical sense, but i continue to get an invalid input paramter to my "Apply to Each" step.
-
Manual Trigger
-
Get Items
-
Initialize Variable String: 'AllEmails'
-
Outer "Apply to Each" loop: Expression: body('Get_items')?['value']
-
inside loop, Condition Step to see if the field tields an array or a single object.
-
True Branch: Expression (for multiple contacts (array) detected: @equals(type(items('Apply_to_each')?['Preparer_x003a_']), 'Array')
-
Apply to Each 1: expression: items('Apply_to_each')?['Preparer_x003a_']
-
Append to String Variable: variables('AllEmails') & items('Apply_to_each_nested')?['Email'] & ','
-
False Branch: Append to String Variable: variables('AllEmails') & items('Apply_to_each')?['Preparer_x003a_']?['Email'] & ','
-
I will (in future) repeat all of step 5 above for the other 2 columns that have contacts in them. For now, I want to get this correct with just one column.
-
Compose (Split Emails into Array): split(variables('AllEmails'), ',')
-
Compose (Remove duplicates): union(outputs('Split_Emails'), outputs('Split_Emails')
-
Compose (Final Email List): join(outputs('Remove_Duplicates'), ';')
-
Send e-mail V2: "To" field: outputs('Final_Email_List')
I have reviewed each step for syntax, case sensitivity, correct reference step names, etc. However, I cannot save this flow, or run it to see specific outputs or failures. The repeated error i receive is: The input parameter(s) of operation 'Apply_to_each' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'Apply_to_each'.
Since there are MANY input parameters, it's not very helpful to show me this without any direction as to which parameter is incorrect.
Things i have also done to ensure success:
-
Temporarily put in a compose step after "Get Items' t see the output- it's pulling data just fine from my SharePoint List.
-
Confirmed there are no empty fields (i am only testing with FIlter Query of 1 item at this time- it's completely populated on the list.
Here is an overview of the structure of the flow steps i have outlined above:
