cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
garnern2
Helper I
Helper I

Append JSON Object in Apply to Each, or something else?

I'm sure PowerAutomate can do this, but I'm not sure I can. I want to send an adaptive card in Teams each week for a manager to issue a simple verification for each of the manager's employees. I have the data in a Sharepoint List, and I'm sending the following card: 

 

 

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            "horizontalAlignment": "Center",
            "size": "Large",
            "weight": "Bolder",
            "color": "Attention",
            "text": "Employee Hair Color"
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Submit",
                    "title": "Submit for Week"
                }
            ],
            "horizontalAlignment": "Center"
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "width": 60,
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Dyanmic Employee Name",
                            "wrap": true,
                            "height": "stretch"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "width": 40,
                    "items": [
                        {
                            "type": "Input.ChoiceSet",
                            "choices": [
                                {
                                    "title": "Brown",
                                    "value": "Brown"
                                },
                                {
                                    "title": "Red",
                                    "value": "Red"
                                },
                                {
                                    "title": "Blue",
                                    "value": "Blue"
                                },
                                {
                                    "title": "Blonde",
                                    "value": "Blonde"
                                }
                            ],
                            "placeholder": "Select Status",
                            "id": "Dyanmic EmployeeNumber"
                        }
                    ],
                    "height": "stretch"
                }
            ],
            "separator": true
        }
    ]
}

 

 

I have no issue sending only one card to a manager using the union function and filtering the array (since the manager's email is listed beside each employee), but I cannot for the life of me figure out how to append the following two JSON objects so only those "belonging" to the manager are sent with the card. I've tried variables, but since it is in a for each (since it must loop through each of the entries by manager), it appends everything to the variable and sends the entire list of employees (or until it errors out at the 28k max). These sections need to append based on the employee records for each manager:

 

 

                        {
                            "type": "TextBlock",
                            "text": "Dyanmic Employee Name",
                            "wrap": true,
                            "height": "stretch"
                        }

 

 

How can I do this for multiple managers with varying numbers of employees?

 

                        {
                            "type": "Input.ChoiceSet",
                            "choices": [
                                {
                                    "title": "Brown",
                                    "value": "Brown"
                                },
                                {
                                    "title": "Red",
                                    "value": "Red"
                                },
                                {
                                    "title": "Blue",
                                    "value": "Blue"
                                },
                                {
                                    "title": "Blonde",
                                    "value": "Blonde"
                                }
                            ],
                            "placeholder": "Select Status",
                            "id": "Dyanmic EmployeeNumber"
                        }

 

1 REPLY 1
garnern2
Helper I
Helper I

Any ideas on this?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,111)