cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kog8790
Advocate I
Advocate I

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

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



1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

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

View solution in original post

1 REPLY 1
Expiscornovus
Dual Super User
Dual Super User

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

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

Canadian Cloud 2022 768x460.png

Register for a free PVA chatbot creation workshop.

Learn how to respond rapidly to your customers and employees at scale, using intelligent conversational chatbots.

Top Solution Authors
Top Kudoed Authors
Users online (3,399)