Looply Academy
  • Getting Started
    • What is Looply?
    • Deployment Models
  • System Requirements
  • SAP Integration: ABAP Add-on & Access
  • Security & Identity - What IT Teams Need to Know
  • Authenticating Teams User Actions to Enterprise Systems
  • Signing Up & Onboarding Your Team
  • Looply Implementation Plan
  • Looply Integration Demos
  • Integrations
    • Microsoft Integration
    • SAP Integration
      • Installing the ABAP Looply Add-On
        • Gateway Service Setup - Single System
        • Gateway Service Setup - Hub scenario
      • Triggering or Resuming a Looply Workflow from SAP
      • Triggering SAP code from Looply
      • SAP Workflow Integration
      • Varo/Stelo Integration
      • SSL & IP address
      • SSO Authentication
  • App Management
    • Building Apps
    • Deploying apps to Teams App catalog
      • Looply Dashboard
      • Manual Installation
    • Installing Looply Apps
    • Uninstall/Update Looply Apps
    • Teams Admin center
  • Adaptive Cards
    • Building Adaptive Cards
      • Container Elements
      • Content Elements
      • Input Elements
      • Actions
    • Data Binding
    • Conditional Rendering
    • AI Assistant
    • Inline Functions
  • Workflows
    • Building Workflows
    • Triggering Workflows
    • Environment Variables & Profiles
    • Versioning Workflows
    • Using HTTP Requests
    • Using Functions
    • Using Conditionals
    • Using Branch Conditionals
    • Using Advanced Conditionals
    • Using Integrations
      • Adaptive Card Actions
      • SAP Requests
    • Using Redirects
    • Using Override Payload
    • Terminating Workflows
  • Data Vault
    • Variable Datastores
  • Monitoring & Logs
    • Monitoring Workflows
    • Error Notifications
  • API REFERENCE
    • Developer API Overview
    • Workflow API
    • Adaptive Card API
  • Team Management
    • Managing Organisations
    • Team Roles and Permissions
  • Resources
    • JavaScript Libraries
  • Tutorials
    • Creating MS Teams Apps
    • Designing Workflows
    • Building Adaptive Cards
    • Adaptive Cards with AI
    • Examining Workflow Executions
  • Support
    • Changelog
    • Contacting Support
Powered by GitBook
On this page
  • Linking a Workflow to an Adaptive Card
  • Simple Data Binding
  • Binding JSON Arrays
  1. Adaptive Cards

Data Binding

Bind data from your Looply Workflow directly into your Adaptive Card.

PreviousActionsNextConditional Rendering

Last updated 1 year ago

The data binding feature from the Adaptive Card designer allows the binding of any JSON attribute from the to an element on an Adaptive Card.

Linking a Workflow to an Adaptive Card

When adding an Adaptive Card to a Workflow, if you click "Create new card" this will create a new Card but will also link the Workflow Schema to the Adaptive Card allowing you to bind for example the result from an API request to a on your Adaptive Card. Find a more in-depth explanation from the or check out .

Simple Data Binding

Whilst in the Adaptive Card Designer you will notice a , this holds the data that can be bound to the Adaptive Card you are creating. Data can be added to this code editor or it can be pulled from the workflow schema where this card is bound. Below is a sample that takes data from a Workflow Schema:

{
    "payload": {
        "output": {
            "workflow_version": "1",
            "workspace_id": "****",
            "workflow_process_id": "****",
            "workflow_id": "****",
            "looply_sap_profile_settings": {
                "requires_sap_profile": false
            },
            "executor": "****",
            "organization_id": "****",
            "workflow_execution_id": "****",
            "workflow_trigger_type": "REQUEST"
        },
        "description": "Request"
    },
    "WorkflowStartState": null,
    "function_1": {
        "output": "hello world",
        "description": "My Function"
    }
}
{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            "text": "${$root.payload.output.workflow_id}" // data binding
        }
    ],
    "version": "1.5"
}

Note: Manually typing in data bindings must follow the above syntax.

Binding JSON Arrays

{
    "payload": {
        "output": {
            "process_id": "****",
            "workflow_id": "****",
            "workflow_execution_id": "****",
            "version": "5",
            "scenario_id": "****",
            "workflow_version": "1",
            "workspace_id": "****",
            "util_data": [ // array of JSON objects to bind
                {
                    "title": "Claim not approved",
                    "value": "1"
                },
                {
                    "title": "Query with claim",
                    "value": "2"
                },
                {
                    "title": "Incorrect grade / SCP claimed",
                    "value": "3"
                },
                {
                    "title": "Incorrect payment type claimed",
                    "value": "4"
                }
            ],
            "organization_id": "****",
            "workflow_trigger_type": "REQUEST",
            "recipient": "email@example.COM",
            "step": "****"
        },
        "description": "Request"
    }
}

Displaying Singular Items.

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            "text": "${$root.payload.output.util_data[2].title}" // data binding
        }
    ]
}

Displaying Lists

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            "$data": "${$root.payload.output.util_data}", // data context
            "text": "${title}" // data binding
        }
    ]
}

Using JSON Arrays in Input.ChoiceSets

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "Input.ChoiceSet",
            "choices": "${$root.payload.output.util_data}", // data binding
            "placeholder": "Choices"
        }
    ]
}

Data binding can be done on a wide variety of properties ranging from the Text property of a to the choices of an .

Binding data from the is easy. You can do it via any of these 3 ways:

When an element on the has been selected, some elements like the will show you a "Bind..." button. Clicking on this will pull up a dropdown menu showing you all the attributes you can bind to the . This dropdown is generated via the data supplied in the .

When an element on the has been selected, the should have all the customisation options for the respective field. Notice that certain fields have a button displaying "...", clicking on this will pull up a dropdown menu showing you all the attributes you can bind to this particular property. Like option 1, this dropdown is generated via the data supplied in the .

You can manually type in the binding directly into the .

Note: Please note that if a binding is incorrectly typed directly into the , the adaptive card canvas may not appear.

Binding will appear in the as shown below:

Data in our may contain arrays of strings or arrays of JSON objects. Binding these structures to our Adaptive Card is a little different from the above which follows a more one-to-one approach.

Note: Manually typing data bindings from an array is highly advised. Using the will result in incorrect mappings for array items.

If the data within the looked as follows:

Displaying only the 3rd title from our util_data array is straightforward and replicates process 3 from .

If we want to display a for each of the title values in our util_data array we need to manually type this binding into our against our . A "data context" has to be established on our - this means that the is only observing data within a certain attribute within our . Due to a data context being applied to the , our binding will appear shorter than the above approach. Below is how we can display 8 TextBlocks, where each element points to a different title in our util_data array.

Note: Binding data using a "data context" will stop the Adaptive Card Designer from immediately showing the final rendered card. You will have to use the Test Card action to see the final result - then: View>Test Card.

You can bind data directly to the choices attribute of an . This is particularly useful if the choices are dynamic and could change.

Note: This works due to the structure of util_data replicating that of an choices attribute array. Always test your card using the Test Card action in the View menu of the to check the binding has worked.

Check out Chapter 7 of our Building Adaptive Cards tutorial!
Check out Chapter 8 of our Building Adaptive Cards tutorial!
Simple Data Binding
Using Integrations Section
Chapter 1 of our Building Adaptive Cards tutorial
Simple Data Binding
Simple Data Binding
TextBlock
TextBlock
TextBlock
TextBlock
TextBlock
TextBlock
TextBlock
TextBlock
TextBlock
Input.ChoiceSet
Input.ChoiceSet
Input.ChoiceSet
Sample Data Editor
Sample Data Editor
Sample Data Editor
Sample Data Editor
Adaptive Card Canvas
Sample Data Editor
Adaptive Card Canvas
Element Properties Toolbar
Sample Data Editor
Card Payload Editor
Card Payload Editor
Card Payload Editor
Sample Data Editor
Element Properties Toolbar
Sample Data Editor
Card Payload Editor
Sample Data Editor
Card Toolbar
Card Toolbar