Product Lifecycle Management Blogs by SAP
Dive into product lifecycle management news, learn about digitalizing PLM for the digital supply chain, and stay informed with product updates from SAP.
cancel
Showing results for 
Search instead for 
Did you mean: 
This blog enables you to notify workers via Teams using the powerful extensibility capabilities of SAP Digital Manufacturing as well as the Business Technology Platform.
To achieve this I am making use of the @mention capabilities of MS Teams.

This is only a simple example on how to use the Format cards in Microsoft Teams in order to mention users. It can be expanded to cover Use cases such as:

  1. Notifying Supervisors on certain Events in a Production/Process Order

  2. Requesting release of Process/Production Orders

  3. Notifying other departments

  4. Many more


Furthermore the Cards can be used to enhance the Look of messages.
Please refer to Format cards in Microsoft Teams

This example uses the default schema for "User mention in Incoming Webhook with Adaptive Cards" according to this Microsoft Teams Documentation. The schema definition can be expanded to fit your individual customer requirements.

Adaptive Card Designer

Prerequisites:


In order to get started with the initial Integration please refer to blog by kevin.hunter3:
Integrating Microsoft Teams with SAP Digital Manufacturing Cloud

Setup:


Create a Service:




  • Select Add

  • Select New Service

  • Make the following entries






  • Add Body Schema:

  • Content Type: application/json

  • Data Type: Structure

  • Schema: Define Inline Schema


Paste the following:
{
"type": "object",
"properties": {
"type": {
"type": "string"
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"contentType": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"body": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"text": {
"type": "string"
}
}
}
},
"$schema": {
"type": "string"
},
"version": {
"type": "string"
},
"msteams": {
"type": "object",
"properties": {
"entities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"text": {
"type": "string"
},
"mentioned": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"required": [
"type",
"attachments"
]
}


  • Click Save

  • Click Create for the Service


Use the Service in a Production Process:


The following is a simple example to test the functionality:




  • Script Task:


$output.attachments=[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"content":{
"type":"AdaptiveCard",
"body":[
{
"type":"TextBlock",
"text":"Hi <at>Firstname Lastname</at>"
}
],
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"version":"1.0",
"msteams":{
"entities":[
{
"type":"mention",
"text":"<at>Firstname Lastname</at>",
"mentioned":{
"id":"firstname.lastname@examplemail.de",
"name":"Firstname Lastname"
}
}
]
}
}
}
]


  • Define the output parameter of the script as your newly created schema. Make sure to select the attachmentsSchema within





  • Make the following entries in the MicrosoftTeamsMention Block:



 

  • Deploy and Test


With this done you can check for the messages in your Teams channel.



Summary:



  1. Do preparation of teams integration.

  2. Create a custom Service to mention people

  3. Adjust the schema to your requirements

  4. Use the Service in you Production Processes


Thanks for reading. If you have any further questions let me know in the comments.
Relevant community resources:
3 Comments
shamshul3559
Discoverer
0 Kudos
Hey jonas_haas

I followed above guided steps in Manage Web service and Service Registry thankfully, but in Design Production Process at the end unable to fix input and output in the dropdown list. For Start, Script and Microsoft Service and Process block i can't set and see some of the dropdown list.

Attached the Screenshot of Production Process Design.

Suggest me what could be the possible reasonn?

Thankyou
Shamshul Arfin

 


 

0 Kudos
Hi Arfin,

in your screenshot you have the start element selected. In that element you are passing the entire JSON. Instead please only include the data that you need. E.g. : Plant: String; Firstname: String; Lastname: String. Then in the scripttask build the final structure. The attachments you have to pass to the service are built in the Scripttask. In my screenshot you can see that the service is selected so the service parameters are shown.

attachements and types are a substructure of the RequestBody Schema you created.

Kind Regards
Jonas
0 Kudos
Hi Arfin,

in your screenshot you have the start element selected. In that element you are passing the entire JSON. Instead please only include the data that you need. E.g. : Plant: String; Firstname: String; Lastname: String. Then in the scripttask build the final structure. The attachments you have to pass to the service are built in the Scripttask. In my screenshot you can see that the service is selected so the service parameters are shown.

attachements and types are a substructure of the RequestBody Schema you created.

Kind Regards
Jonas