Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Call your Power Automate cloud flow from Copilot Studio

  1. Open your existing topic in Copilot Studio and go back to the bottom of your flow, as shown below. Click Call an action, and you should see your brand new Power Automate cloud flow in the list under the Basic actions tab. From the list, select your Get Ticket Status flow. A screenshot of a computer Description automatically generated

    Pro tip: If you don’t see the cloud flow you’ve created, Save the topic, and refresh the page to try again.

  2. When you select your Get Ticket Status flow, you will see a new Action node is automatically added.

    • If the flow requires an input, it requests the value to be selected. As the flow you created in the previous steps requires the TicketNumber input, we need to add this input into the Power Automate action by selecting the variable the value is stored in from the user, which is TicketNumber from the previous steps earlier in the lab.
  3. Select Enter or select a value and choose your TicketNumber variable you created in the previous steps of this lab. This is now connected to the Power Automate flow, and outputs the result from Power Automate into the SNTicketInfo variable. A screenshot of a computer Description automatically generated

    Pro tips:

    • If a latency is expected from your integration, go the action’s properties and add a Latency Message, for example: I’m getting these details for you. Hold on…
    • Consider using HTTP requests and connectors directly in Microsoft Copilot Studio to avoid the added latency of invoking and running a cloud flow in Power Automate.
  4. As ServiceNow will return the full details of the incident in a technical, JSON, format, you need to parse it so that Copilot Studio fully understand its content based on its schema.

    • To do this, select Variable management, and then Parse value. A screenshot of a computer Description automatically generated

    To parse the JSON you can use the Rest API Explorer in ServiceNow to get the structure of the body, or get the schema from a sample payload. For the lab, we’re providing sample ServiceNow data below.

    If you struggle copying the below text, go to F:\LabFiles\Misc and open the ServiceNow Sample JSON Payload.txt

    {
        "parent": "",
        "made_sla": "true",
        "caused_by": "",
        "watch_list": "",
        "upon_reject": "Cancel all future Tasks",
        "sys_updated_on": "2018-12-12 23:18:55",
        "child_incidents": "0",
        "hold_reason": "",
        "origin_table": "",
        "task_effective_number": "INC0009005",
        "approval_history": "",
        "number": "INC0009005",
        "resolved_by": "",
        "sys_updated_by": "admin",
        "opened_by": "System Administrator",
        "user_input": "",
        "sys_created_on": "2018-08-31 21:35:45",
        "sys_domain": "global",
        "state": "New",
        "route_reason": "",
        "sys_created_by": "admin",
        "knowledge": "false",
        "order": "",
        "calendar_stc": "",
        "closed_at": "",
        "cmdb_ci": "",
        "delivery_plan": "",
        "contract": "",
        "impact": "1 - High",
        "active": "true",
        "work_notes_list": "",
        "business_service": "",
        "business_impact": "",
        "priority": "1 - Critical",
        "sys_domain_path": "/",
        "rfc": "",
        "time_worked": "",
        "expected_start": "",
        "opened_at": "2018-08-31 21:35:21",
        "business_duration": "",
        "group_list": "",
        "work_end": "",
        "caller_id": "David Miller",
        "reopened_time": "",
        "resolved_at": "",
        "approval_set": "",
        "subcategory": "Email",
        "work_notes": "2018-12-12 23:18:42 - System Administrator (Work notes)\nupdated the priority to high based on the criticality of the Incident.\n\n",
        "universal_request": "",
        "short_description": "Email server is down.",
        "correlation_display": "",
        "delivery_task": "",
        "work_start": "",
        "assignment_group": "",
        "additional_assignee_list": "",
        "business_stc": "",
        "cause": "",
        "description": "Unable to send or receive emails.",
        "origin_id": "",
        "calendar_duration": "",
        "close_notes": "",
        "notify": "Do Not Notify",
        "service_offering": "",
        "sys_class_name": "Incident",
        "closed_by": "",
        "follow_up": "",
        "parent_incident": "",
        "sys_id": "ed92e8d173d023002728660c4cf6a7bc",
        "reopened_by": "",
        "incident_state": "New",
        "urgency": "1 - High",
        "problem_id": "",
        "company": "",
        "reassignment_count": "0",
        "activity_due": "2018-12-13 01:18:55",
        "assigned_to": "",
        "severity": "3 - Low",
        "comments": "",
        "approval": "Not Yet Requested",
        "sla_due": "UNKNOWN",
        "comments_and_work_notes": "2018-12-12 23:18:42 - System Administrator (Work notes)\nupdated the priority to high based on the criticality of the Incident.\n\n",
        "due_date": "",
        "sys_mod_count": "3",
        "reopen_count": "0",
        "sys_tags": "",
        "escalation": "Normal",
        "upon_approval": "Proceed to Next Task",
        "correlation_id": "",
        "location": "",
        "category": "Software"
    }
    
  5. Now we will need to select the value to parse by selecting the SNTicketInfo variable from the Power Automate flow action.

  6. Next we will select the Data type to From sample data. A screenshot of a computer Description automatically generated

  7. Now paste in the JSON sample provided in the above steps from, after selecting Get schema from sample JSON and select Confirm. A screenshot of a computer Description automatically generated

  8. Then set a variable to store the parsed record for later user.

    • Create a variable called SNTicketInfoParsed. Its type will automatically be set based on its schema (record).
  9. Now, add a response to give the user of your copilot a formatted response to tell them the status of the ticket.

    • Click the (+) to add a new node and select Send a message.

    • Bold the key information either with the command bar or by surrounding the text with **.

    The status of ticket {Topic.TicketNumber} ({Topic.SNTicketInfoParsed.short_description}) is {Topic.SNTicketInfoParsed.state}

    Pro tip: Copilot Studio and some channels support Markdown for simple formatting.

    A screenshot of a computer Description automatically generated

    • You can look above at the sample JSON to see what data would be returned in what value, however below is a screenshot of the ticket we will lookup later to help you with structuring your message: A screenshot of a computer Description automatically generated
  10. To end the conversation, select Topic management and Go to another topic and select End of Conversation.

  11. Save your topic and test your copilot.

  12. Enter the following prompt:

    What is the status of my ticket INC0007001?

  13. Make sure you check the status of ticket number INC0007001: A screenshot of a chat Description automatically generated

You have successfully created a Power Automate cloud flow and a new topic in Microsoft Copilot Studio that used the flow to provide real time data from an external service to the user!