Brian's Integration and Automation Notes
  • Welcome!
  • Allow Me to Brag a Bit
  • About
  • Integrations
    • ConnectWise Home
      • Authentication
      • API Documentation
  • Automations
    • Teams Notifications Azure Bot
      • Acknowledgement
      • Considerations
      • The Basics/Getting Started
        • Create a Response Handler Workflow in Rewst
        • Getting the IDs from Teams
      • Two Stage Message Process
        • Formatting the Initial Message
        • Getting the Message IDs
        • Formatting the Message Update
      • Formatting Action Buttons
        • Approve/Deny
        • Assign Resource to Ticket
      • Working with the Responses
      • System Incident/Maintance Notifications
        • Admitting Defeat on the Database
        • The Workflow Structure
      • Resources
    • Automated GitHub/GitBook Update Notifications
      • Prerequisites
      • 1. Set up a Basic Workflow
      • 2. Fork the GitHub Repository
      • 3. Set up Automatic Updates
      • 4. Set up notifications in GitHub
      • 5. Set up Remaining Workflow Actions
  • ConnectWise PSA Actions
    • About
    • Assigning Resources to Tickets
    • Ticket Assignment Note
    • Unbundle Ticket
    • Sales Activity Assignment Note
Powered by GitBook
On this page
  1. Automations
  2. Teams Notifications Azure Bot
  3. Formatting Action Buttons

Approve/Deny

One of the basic actions is a need to approve/deny a request. Using the Adaptive Card Designer, I copied out the basics of the approve/deny JSON and edited to how it is below. You'll note that the "data" key under the "Action.Submit" is highly customizable. This action is placed in the "body" section of the card update.

In this example, you'll see the information that I determined was necessary to be able to handle the approval/denial of a submission from our service desk to our software subject matter experts who review if the submission meets the threshold to submit to our developers. This workflow is triggered on a ConnectWise PSA ticket record saved that matches the right board and status.

I added the following fields for the response handler workflow:

  • "Type" - I use this to condition the initial noop on the response handler workflow to determine which sub-workflow is required

  • "ServiceTicketId"

  • "ApprovedTicketNote" - This is the ticket note ID used to generate the approval. In the video for the 4/5 ROC Open Mic, you'll see that this is the note that I used to format all of the information for the SME (we have since moved this away from our QA team) to review. On approval, I use this to obtain the note/time entry and send the same information off to our Azure DevOps to create the work item.

  • "CardID"/"CardActivityId" - The information returned from the original message needed to update this message again once the response is recorded.

{
  "type": "Container",
  "id": "466ee0a4-b5ba-520e-0b5d-53841fffe66e",
  "padding": "Default",
  "items": [
    {
      "type": "ActionSet",
      "actions": [
        {
          "type": "Action.ShowCard",
          "title": "Approve",
          "card": {
            "type": "AdaptiveCard",
            "body": [
              {
                "type": "Input.Text",
                "id": "ApproveReason",
                "placeholder": "Add a reason",
                "isMultiline": true,
                "isRequired": true
              },
              {
                "type": "ActionSet",
                "actions": [
                  {
                    "type": "Action.Submit",
                    "title": "Submit",
                    "data": {
                      "Type": "QAApproval",
                      "ServiceTicketId": "{{ CTX.body.Entity.id }}",
                      "ApprovedTicketNote": "{{ CTX.sorted_notes[CTX.last_note_int].id }}",
                      "CardId": "{{ CTX.card_id }}",
                      "CardActivityId": "{{ CTX.card_activity_id }}"
                    }
                  }
                ]
              }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "padding": "None"
          },
          "style": "positive",
          "isPrimary": true
        },
        {
          "type": "Action.ShowCard",
          "title": "Decline",
          "card": {
            "type": "AdaptiveCard",
            "body": [
              {
                "type": "Input.Text",
                "id": "DeclineReason",
                "placeholder": "Add a reason",
                "isMultiline": true,
                "isRequired": true
              },
              {
                "type": "ActionSet",
                "actions": [
                  {
                    "type": "Action.Submit",
                    "title": "Submit",
                    "data": {
                      "Type": "QAApproval",
                      "ServiceTicketId": "{{ CTX.body.Entity.id }}",
                      "CardId": "{{ CTX.card_id}}",
                      "CardActivityId": "{{ CTX.card_activity_id }}"
                    }
                  }
                ]
              }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "padding": "None"
          }
        }
      ],
      "spacing": "None"
    }
  ],
  "spacing": "None"
}
PreviousFormatting Action ButtonsNextAssign Resource to Ticket

Last updated 1 year ago