on 2024 Jan 05 9:23 AM
Hi Experts,
I have integrated MS Team into SAP DMC using this blogs . I am getting message in a Same format as mentioned below
but instead of this I need message in a table format as mentioned below
Can anyone please help me out on this.
Thanks & Regards
Request clarification before answering.
Hi Kartik,
Microsoft Teams has something called Adaptive Cards https://adaptivecards.io/samples/ which might be able to display the data in a table. This requires formatting the JSON message created in SAP DM into the adaptive card format and sending it to teams. Here is a sample of an integration card I created and sent to Teams.
Thanks
Kevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also check this page https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?... that explains how to format messages for integration cards.
Thanks
Kevin
var content = {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [{
"type": "TextBlock",
"text": "Service Request ",
"wrap": true,
"size": "large",
"color": "accent",
"isSubtle": true,
"id": "acTitel"
}, {
"type": "ColumnSet",
"columns": [{
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "Raised by",
"wrap": true,
"weight": "Bolder",
"id": "a"
}
]
}, {
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "User ID\n",
"wrap": true,
"id": "acUserID"
}
]
}
]
}, {
"type": "TextBlock",
"text": "At Location",
"wrap": true,
"size": "Large",
"weight": "Bolder",
"separator": true
}, {
"type": "FactSet",
"facts": [{
"title": "Workcenter",
"value": "sWorkcenter"
}, {
"title": "Operation",
"value": "sOperation"
}, {
"title": "Resource",
"value": "sResource"
}
],
"id": "acLocation"
}, {
"type": "TextBlock",
"text": "Current Product ",
"wrap": true,
"separator": true,
"size": "Large",
"weight": "Bolder"
}, {
"type": "FactSet",
"facts": [{
"title": "Order",
"value": "sOrder"
}, {
"title": "SFC",
"value": "sSFC"
}
],
"id": "acProduct"
}
],
"actions": [{
"type": "Action.OpenUrl",
"title": "View Order Details",
"url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
"id": "acActionViewOrderDetails"
}
]
};
content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;
$output.content = content;
Sure, I have the script above in a script task and this creates the JSON message that I pass to the MS Teams Service . The example above is what created the screenshot in my previous comment. You will need to paste in your DM url into the url field and create the appropriate inputs and output.
Hope this helps
Kevin
Hi Kartik,
Apologies I misunderstood your question, the schema is already in the blog post. Its exactly the same schema as if you were just sending text, you basically just send the JSON structure created by the script I posted above and send it to the same schema in the blog post.
Thanks
Kevin
Hi Kevin,
After using same JSON Structure and Schema which was given in your blog post. I am getting message in JSON format (Screenshot attached) but I want in a same way as you posted above like a job card.
JSON Structure
var content = {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [{
"type": "TextBlock",
"text": "Service Request ",
"wrap": true,
"size": "large",
"color": "accent",
"isSubtle": true,
"id": "acTitel"
}, {
"type": "ColumnSet",
"columns": [{
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "Raised by",
"wrap": true,
"weight": "Bolder",
"id": "a"
}
]
}, {
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "User ID\n",
"wrap": true,
"id": "acUserID"
}
]
}
]
}, {
"type": "TextBlock",
"text": "At Location",
"wrap": true,
"size": "Large",
"weight": "Bolder",
"separator": true
}, {
"type": "FactSet",
"facts": [{
"title": "Workcenter",
"value": "sWorkcenter"
}, {
"title": "Operation",
"value": "sOperation"
}, {
"title": "Resource",
"value": "sResource"
}
],
"id": "acLocation"
}, {
"type": "TextBlock",
"text": "Current Product ",
"wrap": true,
"separator": true,
"size": "Large",
"weight": "Bolder"
}, {
"type": "FactSet",
"facts": [{
"title": "Order",
"value": "sOrder"
}, {
"title": "SFC",
"value": "sSFC"
}
],
"id": "acProduct"
}
],
"actions": [{
"type": "Action.OpenUrl",
"title": "View Order Details",
"url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
"id": "acActionViewOrderDetails"
}
]
};
content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;
$output.content = content;
Schema
{
“type”: “object”,
“properties”:
{
“text”:
{
“description”: “Message To Be Sent”,
“type”: “string”
}
},
“required”: [
“text”
]
}
Message Screen
Hi Kartikksinghal,
you can checkout the following blog for the general adaptive card approach.
Use the Adaptive Card Designer and refer to the table example.
Kind Regards
Jonas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonas,
Thanks for helping me out.
Can you help me to correct me Schema that we need to define in Manage service registry.
This is my Message format
Script Code
var content = {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [{
"type": "TextBlock",
"text": "Service Request ",
"wrap": true,
"size": "large",
"color": "accent",
"isSubtle": true,
"id": "acTitel"
}, {
"type": "ColumnSet",
"columns": [{
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "Raised by",
"wrap": true,
"weight": "Bolder",
"id": "a"
}
]
}, {
"type": "Column",
"width": "stretch",
"items": [{
"type": "TextBlock",
"text": "User ID\n",
"wrap": true,
"id": "acUserID"
}
]
}
]
}, {
"type": "TextBlock",
"text": "At Location",
"wrap": true,
"size": "Large",
"weight": "Bolder",
"separator": true
}, {
"type": "FactSet",
"facts": [{
"title": "Workcenter",
"value": "sWorkcenter"
}, {
"title": "Operation",
"value": "sOperation"
}, {
"title": "Resource",
"value": "sResource"
}
],
"id": "acLocation"
}, {
"type": "TextBlock",
"text": "Current Product ",
"wrap": true,
"separator": true,
"size": "Large",
"weight": "Bolder"
}, {
"type": "FactSet",
"facts": [{
"title": "Order",
"value": "sOrder"
}, {
"title": "SFC",
"value": "sSFC"
}
],
"id": "acProduct"
}
],
"actions": [{
"type": "Action.OpenUrl",
"title": "View Order Details",
"url": "https://xxxxxxxxx.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder&/ShopOrders/ShopOrderBO:",
"id": "acActionViewOrderDetails"
}
]
};
content.body[1].columns[1].items[0].text = $input.userID;
content.body[3].facts[0].value = $input.workcenter;
content.body[3].facts[1].value = $input.operation;
content.body[3].facts[2].value = $input.resource;
content.body[5].facts[0].value = $input.order;
content.body[5].facts[1].value = $input.SFC;
content.actions[0].url = content.actions[0].url + $input.plant + "," + $input.order;
$output.content = content;
Schema
{
"type": "object",
"properties": {
"type": { "type": "string", "const": "AdaptiveCard" },
"$schema": { "type": "string" },
"version": { "type": "string" },
"body": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"text": { "type": "string" },
"wrap": { "type": "boolean" },
"size": { "type": "string" },
"color": { "type": "string" },
"isSubtle": { "type": "boolean" },
"id": { "type": "string" },
"columns": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"width": { "type": "string" },
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"text": { "type": "string" },
"wrap": { "type": "boolean" },
"weight": { "type": "string" },
"id": { "type": "string" }
},
"required": ["type", "text", "wrap", "weight", "id"]
}
}
},
"required": ["type", "width", "items"]
}
},
"separator": { "type": "boolean" },
"weight": { "type": "string" },
"facts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": { "type": "string" },
"value": { "type": "string" }
},
"required": ["title", "value"]
}
},
"actions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string", "const": "Action.OpenUrl" },
"title": { "type": "string" },
"url": { "type": "string" },
"id": { "type": "string" }
},
"required": ["type", "title", "url", "id"]
}
}
},
"required": ["type"]
}
}
},
"required": ["type", "$schema", "version", "body"]
}
This Schema is not working. Can u please help me in correcting this schema
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.