Forum Discussion
Adding hyperlink in adaptive card table
Hi Team,
We have created a table in javascript using adaptive cards,(columnset) and in that table, we want to display some hyperlinks, but we are not able to achieve that, we are able to display those links as text but not as a hyperlink.
Please find below what we are able to achieve:
we want the highlighted part to be hyperlinks.
Also, find the coding we have done to achieve this:
var element = context.incident1;
var msg = {
"attachments":[
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"msTeams": { "width": "full" },
"body": [],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2"
}
}
]
};
//for(var i=0;i<element.length;i++){
var body1 =
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width":"stretch",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Incident Number",
},
]
},
{
"type": "Column",
"width":"stretch",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Description",
},
]
},
{
"type": "Column",
"width":"stretch",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Status",
},
]
},
{
"type": "Column",
"width":"stretch",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Priority",
},
]
},
{
"type": "Column",
"width":"stretch",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Resolver Group",
},
]
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "bolder",
"text": "Ticket Link",
},
],
},
]
};
for(var i=0;i<element.length;i++){
body1.columns[0].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": element[i].number,
});
body1.columns[1].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": element[i].short_description,
});
body1.columns[2].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": element[i].state,
});
body1.columns[3].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": element[i].priority,
});
body1.columns[4].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": element[i].u_resolver_group,
});
body1.columns[5].items.push({
"type": "TextBlock",
"separator":true,
"width":"auto",
"text": "https://epiroctest.service-now.com/ep?id=ticket&table=incident&view=sp&sys_id="+element[i].sys_id
});
}
msg.attachments[0].content.body.push(body1);
print(JSON.stringify(msg));
Please let me know what can we do to achieve this.
Thanks