cancel
Showing results for 
Search instead for 
Did you mean: 

MS Team Message Format

ksinghal
Explorer
0 Kudos

Hi Experts,

I have integrated MS Team into SAP DMC using this blogs . I am getting message in a Same format as mentioned below

ksinghal_0-1706590470013.png

but instead of this I need message to print in format as mentioned below

ksinghal_1-1706590507248.png

I have already written code for Script task (Attached Below)

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;

But I need Schema that we need to define in Service Registry

Also, I need to know that which Data Type I need to select.

ksinghal_2-1706590872371.png

BR.

ksinghal
Explorer
0 Kudos

Hi,

Can anyone please help me on this??

View Entire Topic
Jonas_Haas
Discoverer
0 Kudos
{
   "type":"message",
   "attachments":[
      {
         "contentType":"application/vnd.microsoft.card.adaptive",
         "content":{
            "type":"AdaptiveCard",
            "body":[
               {
                  "type":"TextBlock",
                  "text":"Service Request",
                  "wrap":true,
                  "style":"heading",
                  "fontType":"Default",
                  "size":"Large",
                  "color":"Accent",
                  "isSubtle":true
               },
               {
                  "type":"ColumnSet",
                  "columns":[
                     {
                        "type":"Column",
                        "width":"auto",
                        "items":[
                           {
                              "type":"TextBlock",
                              "text":"Raised By",
                              "wrap":true
                           }
                        ]
                     },
                     {
                        "type":"Column",
                        "width":"stretch",
                        "items":[
                           {
                              "type":"TextBlock",
                              "text":"kevin.hunter@sap.com",
                              "wrap":true
                           }
                        ]
                     }
                  ]
               },
               {
                  "type":"TextBlock",
                  "text":"At Location",
                  "wrap":true,
                  "style":"heading",
                  "separator":true,
                  "size":"ExtraLarge"
               },
               {
                  "type":"FactSet",
                  "facts":[
                     {
                        "title":"Workcenter",
                        "value":"123"
                     },
                     {
                        "title":"Operation",
                        "value":"1234"
                     },
                     {
                        "title":"Resource",
                        "value":"12345"
                     }
                  ]
               },
               {
                  "type":"TextBlock",
                  "text":"Current Product",
                  "wrap":true,
                  "style":"heading",
                  "separator":true,
                  "size":"ExtraLarge"
               },
               {
                  "type":"FactSet",
                  "facts":[
                     {
                        "title":"Order",
                        "value":"ORDERTEST1"
                     },
                     {
                        "title":"SFC",
                        "value":"KEVH24"
                     }
                  ]
               }
            ],
            "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
            "version":"1.5",
            "actions":[
               {
                  "type":"Action.OpenUrl",
                  "title":"View Order Details",
                  "url":"https://<<your-dm-url>>.test.execution.eu20.dmc.cloud.sap/cp.portal/site#ManageOrders-Display?sap-ui-app-id-hint=sap.dm.dme.manageorder"
               }
            ]
         }
      }
   ]
}

Please use above payload, you can use the CustomData Type or build a corresponding schema

ksinghal
Explorer
0 Kudos

Hi @Jonas_Haas ,

I tried to implement the above Schema in the Manage service Registry where I have created my service but still I am getting an error.

ksinghal_0-1709195922460.png