web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to choose someone ...
Power Automate
Unanswered

How to choose someone at random from a list?

(1) ShareShare
ReportReport
Posted on by 6

I'm trying to build an automate feature where an email comes into a shared inbox, and then what happens is the system takes the email from that shared inbox and essentially forwards it to a random person from a list of a group chat in teams. I get to creating an array and that makes sense, and then I build a compose function to get it to choose someone at random, but the issue is, it never gets past the array function where it chooses someone at random and i've been stuck here for hours. 

This is basically how the Array should look in my view: email comes to shared inbox > get list of team members > create array and a compose function to get someone at random > forward that email to their inbox. But again, i can not get past the array function to pick someone at random and then move forward. Any help would be appreciated. 

Categories:
I have the same question (0)
  • HarlyTran Profile Picture
    12 on at

    Hello @ET16 , 

    Try my solution 

    HarlyTran_0-1720802462542.png

    Input for compose

    - rand(0,length(outputs('List_members')?['body/value'])) --> This will be return a random number
    Input for compose 1
    - outputs('List_members')?['body/value'][int(outputs('Compose'))] --> This will be return a json includes member name
    Then input and schema for Parse JSON action:
    - Input: outputs("compose_1")
    - Schema:
    {
        "type": "object",
        "properties": {
            "@@odata.type": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "roles": {
                "type": "array",
                "items": {
                    "type": "string"
                }
            },
            "displayName": {
                "type": "string"
            },
            "visibleHistoryStartDateTime": {
                "type": "string"
            },
            "userId": {
                "type": "string"
            },
            "email": {
                "type": "string"
            },
            "tenantId": {
                "type": "string"
            }
        }
    }
     
    Then custom your adaptive card and send it in team chat 
     
     
  • ET16 Profile Picture
    6 on at

    i'm screenshot 1.pngI'm fairly sure i'm skipping a step here or messing itup, but this is what I get. I think you are wanting me to generate a schema but i don't know where to do that 

  • HarlyTran Profile Picture
    12 on at

    Hello @ET16, you just only paste this in scheme section:

    {
        "type""object",
        "properties": {
            "@@odata.type": {
                "type""string"
            },
            "id": {
                "type""string"
            },
            "roles": {
                "type""array",
                "items": {
                    "type""string"
                }
            },
            "displayName": {
                "type""string"
            },
            "visibleHistoryStartDateTime": {
                "type""string"
            },
            "userId": {
                "type""string"
            },
            "email": {
                "type""string"
            },
            "tenantId": {
                "type""string"
            }
        }
    }
     
    don't need for the:
    - Input: outputs("compose_1")
    - Schema:
     
    if you want to generate your own scheme, i show u later
  • HarlyTran Profile Picture
    12 on at

    Hello @ET16 , just paste this in the scheme section: 

    {
        "type""object",
        "properties": {
            "@@odata.type": {
                "type""string"
            },
            "id": {
                "type""string"
            },
            "roles": {
                "type""array",
                "items": {
                    "type""string"
                }
            },
            "displayName": {
                "type""string"
            },
            "visibleHistoryStartDateTime": {
                "type""string"
            },
            "userId": {
                "type""string"
            },
            "email": {
                "type""string"
            },
            "tenantId": {
                "type""string"
            }
        }
    }
  • HarlyTran Profile Picture
    12 on at

    Hello, you just need to paste this in schema section:

    {
        "type""object",
        "properties": {
            "@@odata.type": {
                "type""string"
            },
            "id": {
                "type""string"
            },
            "roles": {
                "type""array",
                "items": {
                    "type""string"
                }
            },
            "displayName": {
                "type""string"
            },
            "visibleHistoryStartDateTime": {
                "type""string"
            },
            "userId": {
                "type""string"
            },
            "email": {
                "type""string"
            },
            "tenantId": {
                "type""string"
            }
        }
    }
  • HarlyTran Profile Picture
    12 on at

    Hello, you just need to paste this in schema section: 

    {
        "type""object",
        "properties": {
            "@@odata.type": {
                "type""string"
            },
            "id": {
                "type""string"
            },
            "roles": {
                "type""array",
                "items": {
                    "type""string"
                }
            },
            "displayName": {
                "type""string"
            },
            "visibleHistoryStartDateTime": {
                "type""string"
            },
            "userId": {
                "type""string"
            },
            "email": {
                "type""string"
            },
            "tenantId": {
                "type""string"
            }
        }
    }
  • ET16 Profile Picture
    6 on at

    First, thank you so much for helping, it looks like I got the JSON to work ,but here for the card. I don't know what i need to put "post in" here. Do I put the whole team chat? or do I have to pick an output from a previous action? I tried to run it by picking a specific team and also a specific output, and it gives me an error both times 

  • HarlyTran Profile Picture
    12 on at

    You can create a Adaptive card, you can check the follow instruction in this link

    And the name of random member you can see in the picture below and insert to everywhere you want in json of adaptive card: 

    HarlyTran_0-1720807174457.png

     

    And with "Post in" you can choose "Channel" or "Group chat", just make sure that is created first in team:

    HarlyTran_1-1720807401178.png

    I just created a "CREATE TEAM CHAT" after using a flow

  • ET16 Profile Picture
    6 on at

    I think what this is doing is essentially choosing a random person from in a team chat, but then sending the message in that team chat. I want it to send a direct message, or even an email.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 506 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 425 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard