Skip to main content

Notifications

Copilot Studio - Building Copilot Studio Chatbo...
Answered

Create a chat from output of query in "list rows present in a table"

(0) ShareShare
ReportReport
Posted on by

Here is my situation. I'm trying to create a chat with qualified colleagues based on user input from interaction with chatbot. My chatbot asks the user a couple of questions, stores the answers as variables, and then calls an action. In this action the variables are passed in, then it queries a table in a spreadsheet for colleagues matching the input criteria and returns their email addresses to the "create a chat in teams" flow. The problem arises that when I do this I get a for each created automatically because there are multiple emails and this creates multiple chats rather than a single group chat which is my goal. If I "compose" the output of email addresses from the excel connector and try to pass them in as a single variable from there I get the following error: "

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Create_a_chat' at line '1 and column '3558' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Create_a_chat' to be referenced by 'repeatItems' or 'items' functions.'.'."}}". Code: 0x80060467 InnerError: '.
 
I know when I manually put in multiple email addresses in the "create a chat" flow I'm able to generate a single group chat so why can't it function the same way when passing multiple addresses in from the excel query?
 
I've searched for a way to concatenate the email addresses with ";" or to have them stored as an array variable but to no avail. No matter what, I get a for each and have to either deal with multiple chats or a failed flow. Multiple chats will not work for my use case. This will cause the plug to be pulled on my project so I can't just "deal" with the inconvenience of it unfortunately. 
 
In closing: Is there a way to get email addresses returned from my excel query to act as acceptable inputs for the "create a chat" flow without it generating multiple chats?
 
excel chat error1.pngexcel chat error2.pngexcel chat error3.png



  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 31,081 on at
    Re: Create a chat from output of query in "list rows present in a table"

    Hi @Kog8790,

     

    You could use a select action to only retrieve the email property values of each item. With a join function you can them together with a semi-colon character. That can be used in the create chat, which will avoid the apply to each.


    Below is an example of that approach.

     

    1. Add a Select action. Use the value of your List rows. Switch the Map field to text mode. Use the expression below

    item()?['Email']

     

    2. Add a condition action. This is to check if it has found matches by using a length function.

    length(body('Select'))

     

    3. Add the Create Chat in the If Yes. Use the expression below for the members to Add field:

    join(body('Select'), ';')

     

    selectemail_joinwithcolon.png

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard

Featured topics