{
"severity": "medium",
"createdDate": "Wed Sep 30 08:42:43 UTC 2020",
"topic": "instance-xxx-outlookemail-events",
"action": "create",
"id": "xxx",
"message": {
"elementKey": "outlookemail",
"accountId": 99999,
"eventId": "eventId",
"companyId": 66666,
"instanceId": 777777,
"instance_id": 777777,
"instanceName": "test-mail",
"instanceTags": [
"soltius-mail"
],
"raw": {
"eventHeaders": {
"id": "777777",
"encodedid": "NTkwMzAw",
"Raw-Element-Key": "outlookemail"
},
"pollDate": 1601455361934,
"messages": [
{
"ChangeKey": "CQAAABYAAADFfXRs5qJyQJRUntt2T2ZWAAD7AKgT",
"ConversationId": "AAQkADY4ZmFkZDEwLTBlMzctNGViMy05ZDc3LTQ4NWU2MTdlOTliMgAQAAXvfXGAyEHBgsssBzbAq18=",
"IsRead": false,
"ReceivedDateTime": "2020-09-30T08:38:07Z",
"Importance": "Normal",
"@odata.id": "odata.id",
"CcRecipients": [
{
"EmailAddress": {
"Address": "testcc1@test.com",
"Name": "testcc1"
}
},
{
"EmailAddress": {
"Address": "testcc2@test.com",
"Name": "testcc2"
}
}
],
"Body": {
"ContentType": "HTML",
"Content": "<html><head></head><body><div class=\"WordSection1\">Dear all</div></body></html>"
},
"ConversationIndex": "ConversationIndex",
"BodyPreview": "Dear all,\r\n\r\nFor your information",
"IsDraft": false,
"InferenceClassification": "Focused",
"LastModifiedDateTime": "2020-09-30T08:38:09Z",
"HasAttachments": true,
"ToRecipients": [
{
"EmailAddress": {
"Address": "rcvto1@test.com",
"Name": "rcvto1"
}
},
{
"EmailAddress": {
"Address": "rcvto2@test.com",
"Name": "rcvto2"
}
}
],
"@odata.etag": "W/\"CQAAABYAAA\"",
"SentDateTime": "2020-09-30T08:38:03Z",
"From": {
"EmailAddress": {
"Address": "sender@test.com",
"Name": "sender"
}
},
"Flag": {
"FlagStatus": "NotFlagged"
},
"ParentFolderId": "ParentFolderId",
"Subject": "Subject",
"WebLink": "WebLin",
"Sender": {
"EmailAddress": {
"Address": "sender@test.com",
"Name": "Sender"
}
},
"IsDeliveryReceiptRequested": false,
"InternetMessageId": "InternetMessageId",
"Id": "AAMkADY4Z",
"IsReadReceiptRequested": false,
"CreatedDateTime": "2020-09-30T08:38:06Z"
}
],
"objectType": "messages"
},
"userId": 99999,
"events": [
{
"elementKey": "outlookemail",
"pollDate": "2020-09-30T08:42:41Z",
"eventType": "UPDATED",
"hubKey": "general",
"objectId": "objectId",
"objectType": "messages"
}
]
},
"user": "notifications@cloud-elements.com"
}
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.json.JsonOutput;
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
import java.text.SimpleDateFormat;
import java.sql.Timestamp;
import net.sf.json.JSON
import net.sf.json.JSONSerializer
import net.sf.json.xml.XMLSerializer
def Message processData(Message message) {
String payload = message.getBody(java.lang.String)
def jsonSlurper = new JsonSlurper();
def object = jsonSlurper.parseText(payload.toString())
JSON json = JSONSerializer.toJSON( payload )
XMLSerializer xmlSerializer = new XMLSerializer()
xmlSerializer.setTypeHintsCompatibility( false )
xmlSerializer.setTypeHintsEnabled( false )
String xml = xmlSerializer.write( json )
message.setBody(xml);
return message;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |