Power Automate Flow for Adaptive Card

Options

I have adapted Dan Snyder's Constituent Data Update Card. It has be working great, but I wanted to add another tab/card to this. I added the JSON text to the bottom of the Compose Adaptive Card JSON but it does not populate on the add-in. Is there a limit? Right now this is what the add-in looks like when opened up.

98867768d50124ec83f706fe8f6facca-huge-im

Here is what it looks like in the compose JSON. It follows the Individual Information text in the Compose Adaptive Card JSON.

},

{

"type": "Action.ShowCard",

"title": "Organization Information",

"card": {

"type": "AdaptiveCard",

"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",

"version": "1.5",

"body": [

{

"type": "TextBlock",

"text": "Only fill in organization name information if adding new or updating a name field for the organization constituent. If you need to add a relationship to the organization record or individual record please use the Relationship Updates card.",

"wrap": true,

"size": "Medium",

"weight": "Default",

"color": "attention"

},

{

"type": "Input.Text",

"placeholder": "Organization Name",

"id": "idOrgName",

"label": "Organization Name"

},

{

"type": "Input.ChoiceSet",

"choices": [

{

"title": "Yes",

"value": "Yes"

},

{

"title": "No",

"value": "No"

}

],

"placeholder": "Is this organization inactive?",

"id": "idOrgInactive"

},

{

"type": "TextBlock",

"text": "Only use if you are adding new or updating a constituent code. ",

"wrap": true,

"size": "Medium",

"weight": "Default",

"color": "attention"

},

{

"type": "Input.ChoiceSet",

"id": "idOrgConstituentCode",

"label": "Organization Constituent Code",

"placeholder": "Choose Constituent Code",

"style": "compact",

"isMultiSelect": false,

"choices": @{body('Select_constituent_code_types')}

},

{

"type": "TextBlock",

"text": "An existing constituent code should not be selected when adding a new constituent code.",

"wrap": true,

"size": "Medium",

"weight": "Default",

"color": "attention"

},

{

"type": "Input.ChoiceSet",

"id": "idOrgExistingConstituentCode",

"placeholder": "",

"label": "Existing Constituent Code",

"style": "compact",

"choices": [

{

"$data": "${ExistingConstituentCode.items}",

"title": "${title}",

"value": "${value}"

}

]

},

{

"type": "@{outputs('Validate_a_user_identity_token')?['body/email']}",

"placeholder": "@{outputs('Validate_a_user_identity_token')?['body/email']}",

"isVisible": false,

"label": "UserEmail"

},

{

"type": "TextBlock",

"text": "Additional Comments",

"wrap": true,

"id": "idOrgComments",

"style": "default",

"fontType": "Default",

"size": "Medium"

},

{

"type": "Input.Text",

"placeholder": "",

"id": "idOrgComments"

},

{

"type": "Input.Text",

"value": "OrganizationInformation",

"isVisible": false,

"id": "idCard"

},

{

"type": "ActionSet",

"actions": [

{

"type": "Action.Webrequest",

"title": "Submit",

"url": "purposefully removed the url"

}

]

}

]

}

}

]

}

]

}

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Wendy Bondeson
    when you don't know if your json is properly formatted, go to the Adaptive Card Designer > click New card > use Blank card, and replace the CARD PAYLOAD EDITOR with the JSON from your flow run history that you “Response” action produce.

    it will have indicator where your errors are.

    generally, issue like missing or extranous comma, brackets is culprit

  • There is definitely a limit. I just removed the email from the JSON and the organization information tab appeared.

    0ead1297e6cfff06c521c9e38d821028-huge-im

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Wendy Bondeson
    just tested this with the adaptive card template downloaded from Dan's sharing.

    the limit you are talking about is specifically on the number of actions buttons

    @Heather McLean @Erik Leaver I think Wendy hit on something that is a problem with BB implementation of the adaptive card. Can you look into this? (while you are at it, BB implementation of adaptive card's action button also doesn't do “style” code that makes the button background show in different color, would be nice to have.

    The same JSON code for adaptive card shown in the Adaptivecard designer

    47ebb05d4a8cdbdb65155ccb6df5212f-huge-im

    whereas BB only display up to 5 (first 5)

    dabbac1402b5179f81e7b056c55b6bb2-huge-im
  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Heather McLean @Erik Leaver adaptive card json code (sample, stripped down so code is smaller) that has this problem, if you want to use it for testing.

    {
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.6",
    "body": [
    {
    "type": "ActionSet",
    "actions": [
    {
    "type": "Action.ShowCard",
    "title": "Address",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.6",
    "body": [
    {
    "type": "Input.ChoiceSet",
    "id": "idExistingAddress",
    "placeholder": "",
    "label": "Existing address",
    "choices": [
    {
    "title": "123 Main St\\r\\nFlushing, NY 11354",
    "value": "1608455"
    }
    ]
    },
    {
    "type": "Input.ChoiceSet",
    "id": "addressType",
    "label": "Address type",
    "value": "Home",
    "choices": [
    {
    "title": "Business",
    "value": "Business"
    },
    {
    "title": "Campus",
    "value": "Campus"
    }
    ]
    },
    {
    "type": "Input.Text",
    "label": "Address Line 1",
    "id": "AddressLine1"
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Employment again",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing employer should not be selected when Adding new employment data.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "Input.ChoiceSet",
    "id": "idExistingEmployer",
    "placeholder": "",
    "label": "Existing employer",
    "choices": [
    {
    "title": "123 Main St\\r\\nFlushing, NY 11354",
    "value": "1608455"
    }
    ]
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Phone",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing phone number should not be selected when Adding a new phone number.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "Input.ChoiceSet",
    "id": "idExistingPhone",
    "placeholder": "",
    "label": "Existing phone",
    "choices": [
    {
    "title": "123 Main St\\r\\nFlushing, NY 11354",
    "value": "1608455"
    }
    ]
    },
    {
    "type": "Input.ChoiceSet",
    "id": "phoneType",
    "label": "Phone type",
    "value": "Mobile",
    "choices": [
    {
    "title": "Cell",
    "value": "Cell"
    },
    {
    "title": "Home",
    "value": "Home"
    }
    ]
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Email",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing email address should not be selected when Adding a new email address.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Employment 3rd",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing employer should not be selected when Adding new employment data.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Employment",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing employer should not be selected when Adding new employment data.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "ActionSet"
    }
    ]
    }
    },
    {
    "type": "Action.ShowCard",
    "title": "Organization",
    "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
    {
    "type": "TextBlock",
    "text": "An existing phone number should not be selected when Adding a new phone number.",
    "wrap": true,
    "size": "Small",
    "weight": "Default",
    "color": "Default"
    },
    {
    "type": "ActionSet"
    }
    ]
    },
    "style": "destructive"
    }
    ]
    }
    ]
    }

  • @Wendy Bondeson, @Alex Wong, @Erik Leaver , @Heather McLean This is an interesting find for sure, although I'd say more of a feature request than a bug.

    Per the Adaptive Card documentation, the Adaptive Card Host SPA was built based off using Outlook Actionable Messages as the host application. Testing this out in the Adaptive Card designer and using Outlook Actionable Messages as the host, I actually receive the following error:

    f5bcb188c0d7895b7e86ef2e2428db19-huge-im

    There is a note in Blackbaud's adaptive card documentation that you can “ignore any warnings you may see in the designer”, although that instruction is specific to using Target versions other than 1.4. At a minimum, @Erik Leaver / @Heather McLean, I do think we should clarify this in the documentation.

    @Wendy Bondeson - One way you could make this work is change the 5th action to a “Show more” action and using an Action.ShowCard to embed additional update options inside that card. It's a bit of a hack but would at least allow you to have all update options in one card.

  • As another option…

    You can actually place actions anywhere in the card (doesn't have to be at the bottom). I think the max validation message is per-ActionSet, so you could create a second ActionSet to contain the additional actions.

    So your overall card would be structured like this (I'm sure Community will mangle the JSON formatting, but hopefully you'll get the idea):

    {
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.4",
    "body": [
    {
    "type": "ActionSet",
    "actions": [
    {...},
    {...},
    {...},
    {...}
    ]
    },
    {
    "type": "ActionSet",
    "actions": [
    {...},
    {...},
    {...},
    {...}
    ]
    }
    ]
    }

    Here's an example of more than 5 cards in the Designer - I haven't tried this with the Adaptive Card Host SPA yet, but it should work:

    bb70c871e1d5dc0cb3986de497e1b4a4-huge-im

    Here's the card JSON for the above screen shot:

    {

    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",

    "type": "AdaptiveCard",

    "version": "1.4",

    "body": [

    {

    "type": "TextBlock",

    "text": "A block of text",

    "wrap": true

    },

    {

    "type": "ActionSet",

    "actions": [

    {

    "type": "Action.Execute",

    "title": "Action 1"

    },

    {

    "type": "Action.Execute",

    "title": "Action 2"

    },

    {

    "type": "Action.Execute",

    "title": "Action 3"

    },

    {

    "type": "Action.Execute",

    "title": "Action 4"

    },

    {

    "type": "Action.Execute",

    "title": "Action 5"

    }

    ]

    },

    {

    "type": "TextBlock",

    "text": "Another block of text",

    "wrap": true

    },

    {

    "type": "ActionSet",

    "actions": [

    {

    "type": "Action.Execute",

    "title": "Action 6"

    },

    {

    "type": "Action.Execute",

    "title": "Action 7"

    },

    {

    "type": "Action.Execute",

    "title": "Action 8"

    },

    {

    "type": "Action.Execute",

    "title": "Action 9"

    },

    {

    "type": "Action.Execute",

    "title": "Action 10"

    }

    ]

    },

    {

    "type": "ActionSet",

    "actions": [

    {

    "type": "Action.Execute",

    "title": "Action 11"

    },

    {

    "type": "Action.Execute",

    "title": "Action 12"

    },

    {

    "type": "Action.Execute",

    "title": "Action 13"

    },

    {

    "type": "Action.Execute",

    "title": "Action 14"

    },

    {

    "type": "Action.Execute",

    "title": "Action 15"

    }

    ]

    }

    ]

    }

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Ben Lambert
    great suggestion, it works in BB Host SPA.

    b373a1ac4101980df863b00c7df156dd-huge-im

Categories