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

Task 03: Build a topic that confirms cancellation, collects issue details, saves the record, and returns a confirmation ID

Introduction

Zava’s COE must show that agents can move from analysis to action while maintaining control over user experience and data handling. Refund submission is a practical example of an enterprise workflow: confirm intent, capture structured inputs, write the record to a system of record, and provide an auditable confirmation identifier.

Description

In this task, you’ll build the refund-submission topic and connect it to refund-initiator for a clean workflow handoff. You’ll implement an adaptive card to collect structured inputs, then use an Agent Flow to generate a confirmation ID and write the refund request to an Excel table stored in SharePoint. The topic returns the confirmation number to the user in a consistent, business-ready message.

Success criteria

  • A topic named refund-submission exists and is configured as a redirect topic that can be invoked from refund-initiator.
  • The confirmation question correctly injects order values from the shared global context variable (order ID and order date).

Key steps

01: Create the topic

  1. On the command bar for the agent, select Topics.

    zfj0eo1z.jpg

  2. On the Topics page, on the command bar, select Add a topic and then select From blank.

    r9f36ktx.jpg

  3. Change the name from Untitled to refund-submission and then press the Enter key to save the change.

    nqlqlia8.jpg

  4. In the Trigger node, hover the mouse cursor over the text The agent chooses and then select Change trigger.

    f8qr80k2.jpg

  5. In the Change trigger dialog, select It’s redirect to.

    d4y3go10.jpg

  6. Below the Trigger node, select Add node (the + sign) and add an Ask a question node.

    veotn5bn.jpg

  7. In the Enter a message field, enter the following text:

     Please note that canceling transaction [order_id] from [order_date] is permanent and can't be undone. Before you proceed, do you want to continue with this cancellation?
    
  8. Highlight and delete [order_id] from the text.

  9. Select Insert Power fx expression.

  10. In the fx field, enter Global.redRefundGlobalShareContext.order_id.

  11. Highlight and delete [order_date] from the text.

  12. Select Insert Power fx expression.

  13. In the fx field, enter Global.redRefundGlobalShareContext.order_date.

    equb46t0.jpg

  14. In the Option for user section, select New option.

    fl27xxen.jpg

  15. In the Enter option field, enter Yes and then press the Enter key.

  16. Repeat Steps 14-15 to create a No option.

    frt6mpge.jpg

  17. In the Save user response as field, select Var1.

  18. In the Variable properties pane, in the Variable name field, enter IsContinue.

    g9s4b6pe.jpg

  19. Close the Variable properties pane.


02: Configure the Yes option

When the customer selects Yes, the agent should proceed with the refund or cancellation process.

  1. On the topic canvas, move down to the Condition nodes. Below the Yes node, select Add node (the + sign).

    m280luva.jpg

  2. Select Ask with adaptive card.

    s2f8eg45.jpg

  3. In the Adaptive Card node, select the ellipses (()) and then select Properties.

  4. In the Adaptive Card Node properties pane, select Edit adaptive card.

    k8xsw14d.jpg

  5. In the Card payload editor pane, delete the existing code. Then, paste the following code into that pane:

     {
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "type": "AdaptiveCard",
     "version": "1.6",
     "body": [
         {
         "type": "TextBlock",
         "text": "Zava Retail Refund Request Form",
         "weight": "Bolder",
         "size": "Large",
         "wrap": true
         },
    
         {
         "type": "FactSet",
         "facts": [
             {
             "title": "Order ID:",
             "value": "${Topic.OrderId}"
             },
             {
             "title": "Order Date:",
             "value": "${Topic.OrderDate}"
             },
             {
             "title": "Unit Price:",
             "value": "${Topic.UnitPrice}"
             },
             {
             "title": "Quantity:",
             "value": "${Topic.Quantity}"
             }
         ]
         },
    
         {
         "type": "Input.Text",
         "id": "Requester",
         "label": "Requester Name",
         "placeholder": "Enter your name",
         "isRequired": true,
         "errorMessage": "Requester name is required."
         },
         {
         "type": "Input.Text",
         "id": "Reason",
         "label": "Reason for Refund",
         "placeholder": "Describe the reason for the refund",
         "isMultiline": true,
         "isRequired": true,
         "errorMessage": "Refund reason is required."
         }
     ],
     "actions": [
         {
         "type": "Action.Submit",
         "title": "Submit Refund Request"
         }
     ]
     }
    
  6. Select Save and then select Close.

    41pazkzm.jpg

  7. In the Adaptive Card Node properties pane, select JSON card and then select Formula.

    nzlvxeyk.jpg

  8. In the Formula field select Expand.

    5hqjgdkn.jpg

  9. Place your cursor in the Formula field and then press the Ctrl F key combination.

  10. In the Find field, search for type: "FactSet"

  11. Locate the following values in the code and then replace them with the values shown below:

    Value to replace New value
    ”${Topic.OrderId}” Global.redRefundGlobalShareContext.order_id
    ”${Topic.OrderDate}” Global.redRefundGlobalShareContext.order_date
    ”${Topic.UnitPrice}” Global.redRefundGlobalShareContext.unit_price
    ”${Topic.Quantity}” Global.redRefundGlobalShareContext.quantity

    hkv3lnr9.jpg

  12. Select Save.


03: Configure the No option

When the customer selects No, the agent should stop the refund process and exit or redirect to the appropriate next step.

  1. Under the Condition node where its set to No add a Send a message node.

    he9kktu3.jpg

  2. Select the text area, then type:

     Great news - your order [order_id] from [date] will remain active. If you have any additional questions, feel free to ask.
    
  3. Highlight [order_id] from the text, delete it then select Insert Power(Fx) expression. Enter the following expression and then select Insert:

     Global.redRefundGlobalShareContext.order_id
    

    2vo74eez.jpg

  4. Highlight [order_date] from the text, select Insert Power(FX) expression, then press Insert to replace it with:

     Global.redRefundGlobalShareContext.order_date
    

    g1saf9hp.jpg

  5. Below the Message node that you just created, select Add node, select Topic management, and then End conversation.

    2xm5dhjq.jpg

  6. Select Save.


04: Define triggering behavior

It’s time to define how one topic will trigger another, ensuring the handoff follows the business context of each request.

  1. Open the refund-initiator topic. Locate the Set variable value node for the True condition.

    hchh48ro.jpg

  2. Below Set variable value node, select Add node.

  3. Select Topic management, and then Go to another topic. Search for and select refund-submission.

    iyodvfgg.jpg

  4. Select Save.

  5. Start a new test session and submit the following prompt:

     How can I request a refund for order TXN-2098, which I no longer need?
    

    The agent redirects you from the refund‑initiator topic to the refund‑submission topic to continue the refund process, then waits for your confirmation before proceeding.

    4tjjjosz.jpg

  6. Select Yes and observe how the adaptive card displays certain variable values in read‑only mode, while allowing the end user to enter the complaint details.

    64z5o50f.jpg

  7. Now let us test the No condition option, first select Start a new session then prompt:

     How can I request a refund for order TXN‑2008, which I no longer need?
    

    Notice how the agent clearly rejects the request while still offering support for anything else the customer may need.

    gy1ys6tq.jpg

04: Create an AgentFlow

  1. Open the refund-submission topic.

  2. Move down to locate the Adaptive Card node.

  3. Below the node, select Add node, select Add a tool, and then select New Agent flow.

    8fd0xtcc.jpg

  4. Select When an agent calls the flow and then select + Add an input.

  5. In the left field, select Text, enter OrderId.

    p4mlb0ik.jpg

  6. Repeat Steps 3-5 to add these additional inputs:

    Value Data type
    OrderDate Date
    UnitPrice Number
    Quantity Number
    Requester Text
    Reason Text

    bhzjn3v2.jpg

  7. Below the When an agent calls the flow node, select Add an action (+).

  8. Search for and select Initialize variable.

    yvu8o237.jpg

  9. At the top right of the action, select the ellipses and then select Rename.

  10. Rename it to Generate Unique Request ID.

    72eipkrx.jpg

  11. Configure the node by using the following information:

    column 1 column 2
    Name ConfirmationId
    Type String
  12. In the Value field, select fx then enter:

     concat('req-', formatDateTime(utcNow(), 'MMddyyHHmmss'))
    

    Then, select Add.

    uuw28l5c.jpg

  13. Add a new Initialize variable action below the Generate Unique Request ID action. Rename the action to Compose - Submission Timestamp.

  14. Configure the action by using the following information:

    column 1 column 2
    Name getSumissionDateTime
    Type String
  15. In the Value field, select fx then enter:

     formatDateTime(utcNow(), 'yyyy-MM-dd HH:mm:ss')
    

    Then, select Add.

    4251ooy4.jpg

  16. Below the Compose - Submission Timestamp action, add an Add a row into a table excel action.

    Be sure to select the Excel Online (Business) option.

    1soikcm2.jpg

  17. Select Sign in. If prompted, sign in by using the following credentials:

    Item Value
    Username @lab.CloudPortalCredential(User1).Username
    Temporary Access Pass (TAP) token @lab.CloudPortalCredential(User1).AccessToken
  18. Select Allow access.

    dlgl60jk.jpg

  19. Enter the following details:

    • Location: SharePoint Site - Zava Retail Data
    • Document Library: Documents
    • File: /SharePointFiles/returnitems/audit-customer-return.xlsx
    • Table: CustomerReturn

    viee0v2a.jpg

  20. In the Advanced parameters section, select Show all.

  21. Delete DateTime Format: by selecting X and configure these columns by using the following information:

    Item Value
    ConfirmationId ConfirmationId
    OrderId OrderId
    OrderDate OrderDate
    UnitPrice UnitPrice
    Quantity Quantity
    RequestDate getSumissionDateTime
    Requester Requester
    Reason Reason

    tklrzf3a.jpg

  22. Select the Respond to the agent then select + Add an output.

    ytxr6p4j.jpg

  23. Select Text then name it ConfirmationNumber then set value to ConfirmationId.

    sow82tsi.jpg

  24. Select Save draft.

  25. Change the name from agentflow to Customer Return Request Processor and then select Publish.

    zv4gued4.jpg


05:

  1. Open the Zava Retail Help Desk Bot. Select Topics and then select refund-submission.

  2. Refresh the page. Locate the Adaptive Card node.

  3. Below the node, select Add node. Select Add a tool and then select Customer Return Request Processor.

    ssjzwfrq.jpg

  4. Configure the Action node using the information provided. In the Enter or select a value field, select the ellipsis (…), choose Formula, and enter the corresponding expression for each item.:

    Field Formula
    OrderId Global.redRefundGlobalShareContext.order_id
    OrderDate Global.redRefundGlobalShareContext.order_date
    UnitPrice Global.redRefundGlobalShareContext.unit_price
    Quantity Global.redRefundGlobalShareContext.quantity
    • For the Requester variable, select Requester.
    • For the Reason variable, select Reason.

    wf3qnep7.jpg

  5. Add a Send a Message node below the Action node you just configured.

  6. Enter the following text in the message field:

     We're sorry to hear that you need to cancel your order. Your cancellation has been successfully processed, and your confirmation number is [insert confirmation number]. If you have any other questions or need further assistance, please don't hesitate to contact us-we're here to help.
    
  7. Highlight and delete [insert confirmation number],leave the cursor on the same place then select {x} then select ConfirmationNumber.

    diap0u6p.jpg

  8. Select Save.

  9. Start a new test session and submit the following prompt:

     How can I request a refund for order TXN-2098, which I no longer need?
    
  10. Select Yes and follow the instructions. Enter the following information when prompted:

    • Requester Name: Alex Rivera
    • Reason for Refund: Received the wrong item. Order included a different product than what was purchased.
  11. Select Submit Refund Request, and then select Allow to save the request details to the Excel table.

    4h3axfoy.jpg

  12. Verify that the record was inserted successfully by opening a new browser tab and entering the following URL:

     https://lodsprodmslearnmca.sharepoint.com/sites/Zava-Retail-Data@lab.LabInstance.Id/Shared%20Documents/SharePointFiles/returnitems/
    
  13. If prompted, sign in by using the following credentials:

    Item Value
    Username @lab.CloudPortalCredential(User1).Username
    Temporary Access Pass (TAP) token @lab.CloudPortalCredential(User1).AccessToken
  14. Select audit-customer-return.xlsx to access the refund detail record.

    6d3fmxj3.jpg