Skip to content

Display Adaptive Card Carousels #144

@akuchuri

Description

@akuchuri

Hi,

I have been using Dynamic Card attached to a Statement in a Scenario to generate a list of Hero Cards and display them in a Carousel layout, which works fine.

I am now trying to switch the Hero Cards with Adaptive Cards but just seeing empty cards returned in the Carousel. Am I missing something or should I look for an alternate way of implementing this? Appreciate any pointers.

Below is what I have tried so far:

Image

Image

(function(){
  var data = ${doctorsList};
  var cards = data.map(function(item) {
    return {
      type: "AdaptiveCard",
      version: "1.5",
      body: [
        {
          type: "Container",
          isVisible: true,
          items: [              
        {
          type: "Image",
          style: "person",
          url: item.imageUrl,
          altText: item.imageAltText,
          size: "medium"
         },
        {
          type: "TextBlock",
          text: item.title,
          weight: "bolder",
          size: "medium",
          wrap: true
        },
        {
          type: "TextBlock",
          text: item.subtitle,
          weight: "bolder",
          wrap: true,
          isSubtle: true
        },
       {
          type: "TextBlock",
          text: item.location,
          weight: "bolder",
          wrap: true,
          isSubtle: true
        }
           ]
      },
    {
      type: "ActionSet",
      actions: [
        {
          type: "Action.OpenUrl",
          title: "View Profile & Schedule",
          url: item.buttonUrl,
          id: item.buttonId
        }
      ]
    }
  ]
  }
});
  return cards;
})();

And below is what I had before inside the Dynamic Card:

(function(){
    var doctors = [];
    for (var i =0 ; i < ${doctors}.count; i++) {
        doctors.push(new builder.HeroCard()
            .title(${doctors}._result[i].title)
            .subtitle(${doctors}._result[i].specialty)
            .text(${doctors}._result[i].location)
            .images([builder.CardImage.create(session,${doctors}._result[i].image_url)])
            .buttons([builder.CardAction.openUrl(session,${doctors}._result[i].url,'View Profile')])
        
        );
    }
    return doctors;
    })()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions