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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How could get the valu...
Copilot Studio
Suggested Answer

How could get the value from user chat

(0) ShareShare
ReportReport
Posted on by 2

I want to use Copilot Studio to create a new user in both an Excel file and an XML file.
When I ask the user to provide information like user name, user ID, and user email, it's fine to request each detail separately, but I would prefer if the user could submit all the information at once.

This way, the agent can locate the necessary details and pass the values to the next step.
For example, if user put :
user name : AAA

user ID: 1233
user email : aaa@outlook.com

the agent can pass the value to the parameter. 
When I ask AI, it use below code, but doesn't really work :

 

- kind: AnswerQuestionWithAI
id: extractDetails
inputProperty: fullUserInput
resultProperty: extractedJson
instructions: |
Extract the following fields from the user's message:


- New User Name
- Email
- User ID
- Model User ID
- Action

**Return ONLY a JSON object (not a string)** with these keys:
{
"newUserName": "",
"newUserEmail": "",
"newUserID": "",
"modelUserID": "",
"actionType": ""
}

Do not wrap the JSON in quotes or code fences. If a field is missing, return an empty string for that key.

- kind: SendActivity
id: debugExtract
activity:
type: message
text: |
Debug — extracted fields:
Name: =extractedJson.newUserName
Email: =extractedJson.newUserEmail
UserID: =extractedJson.newUserID
ModelUserID: =extractedJson.modelUserID
Action: =extractedJson.actionType


- kind: SetMultipleVariables
id: setVars
assignments:
- name: newUserName
value: =extractedJson.newUserName
- name: newUserEmail
value: =extractedJson.newUserEmail
- name: newUserID
value: =extractedJson.newUserID
- name: modelUserID
value: =extractedJson.modelUserID
- name: actionType
value: =extractedJson.actionType
Categories:
I have the same question (0)
  • Suggested answer
    Sajeda_Sultana Profile Picture
    166 on at

    Hi @,

     

    It sounds like what you really want is this:
    “I’d like the user to type all their details in one message, and then have the agent automatically pick out each field (name, ID, email, etc.) and use them to create the user in Excel and XML.”


    So instead of asking three separate questions, you’d like the user to send something like:

    • user name: AAA
    • user ID: 1233
    • user email: aaa@outlook.com

    and then have those values go into variables like newUserName, newUserID, and newUserEmail that you can pass to the next step.


    Your current idea with the JSON extraction block is heading in the right direction, but the problem is that relying on raw AI output to perfectly return JSON is often a bit fragile in Copilot Studio.


    What you’re really looking for is a good way to:

    1. Let the user provide all info in one go.
    2. Reliably map each piece (name, email, IDs, action) into separate variables.
    3. Use those variables to add the user to Excel and generate your XML.

    If that’s what you’re after, there are a couple of patterns that usually work better in Copilot Studio:

    • A “form style” message (for example, an Adaptive Card) where each field is captured directly into its own variable.
    • Or using entities/slot filling so the agent can extract multiple values from one message and only ask follow‑up questions for anything that’s missing.

    If this matches what you’re trying to do, I’m happy to walk through a concrete example of how to set up the topic so the values actually land in your variables and can be passed to Excel/XML.

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.


    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).


    🏷️ For follow-ups  @Sajeda_Sultana

     

  • Sajeda_Sultana Profile Picture
    166 on at

    Just checking in to see if everything is working on your end now. If you still need any assistance, please feel free to reach out.

    If your issue has been resolved, kindly mark the answer as solved so others facing the same question can benefit.

    Thanks, and have a great day!

  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello ,
    You’re using Copilot Studio to let users submit all details (name, ID, email, etc.) in one message and then extract them using an AI step, but the current implementation isn’t working reliably. The issue is mainly due to inconsistent JSON output and how Copilot treats the result (often as a string instead of an object).

    To fix this, you should enforce a stricter extraction prompt that guarantees valid JSON with exact field names, and then use ParseJSON() when assigning values to variables instead of directly referencing them. It also helps to guide users to provide input in a structured format (e.g., “User Name:…, User ID:…, Email:…”), which improves extraction accuracy. For more stability, add validation checks for missing fields. However, for production scenarios like creating users in Excel/XML, a better approach is to use an Adaptive Card form where users enter all details at once, avoiding AI parsing issues entirely and allowing direct parameter mapping.
  • Suggested answer
    CU26041507-0 Profile Picture
    2 on at
    Hi @Sajeda_Sultana
    Thanks for your reply, would you possible to provide an example and step for below :
    • Or using entities/slot filling so the agent can extract multiple values from one message and only ask follow‑up questions for anything that’s missing.
  • Suggested answer
    Sajeda_Sultana Profile Picture
    166 on at
     
    I found a better and more reliable solution for your requirement.

    Since you want the user to input all information at once (user name, user ID, and email), using an Adaptive Card in Copilot Studio is the best approach.
    With an Adaptive Card:
    • All fields are displayed together in a single form
    • The user submits everything in one action
    • The values are automatically mapped to variables
    • No AI parsing or JSON extraction is needed, so it’s much more stable

    How this works in Copilot Studio
    1. In your topic, add a new node and select Ask with adaptive card
    2. In the Adaptive Card node:
    • Set Format to JSON card
    • Click Edit adaptive card
             3. Paste the following JSON:
               
    {
      "type": "AdaptiveCard",
      "version": "1.5",
      "body": [
        {
          "type": "Input.Text",
          "id": "newUserName",
          "label": "User name"
        },
        {
          "type": "Input.Text",
          "id": "newUserID",
          "label": "User ID"
        },
        {
          "type": "Input.Text",
          "id": "newUserEmail",
          "label": "Email",
          "style": "Email"
        }
      ],
      "actions": [
        {
          "type": "Action.Submit",
          "title": "Submit"
        }
      ],
      "$schema": "https://adaptivecards.io/schemas/adaptive-card.json"
    }
     
    What you get after submission
     
    When the user clicks Submit, Copilot Studio automatically populates the outputs:
    • newUserName
    • newUserID
    • newUserEmail
    You can see these values under Outputs of the Adaptive Card node (as shown in the screenshot), and you can directly pass them to:
    • Excel (Add a row)
    • XML generation
    • Power Automate flow
    • Any downstream logic
    No additional parsing or AI extraction is required.
     
     
    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.
    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).
    🏷️ For follow-ups  @Sajeda_Sultana

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 633

#2
Vish WR Profile Picture

Vish WR 301

#3
Haque Profile Picture

Haque 216

Last 30 days Overall leaderboard