on ‎2023 Sep 07 7:55 PM
Request clarification before answering.
Maybe not the most elegant solution but this works for me with incoming Json payload { "company": "abc123" }
def Message processData(Message message) {
//Body
/*To set the body, you can use the following method. Refer SCRIPT APIs document for more detail*/
def messageLog = messageLogFactory.getMessageLog(message);
def pMap = message.getProperties();
def body = message.getBody(java.lang.String) as String;
def jsonSlurper = new JsonSlurper()
input = jsonSlurper.parseText(body)
def builder = new JsonBuilder();
builder {
'CompanyNew' input.company
}
messageLog.setStringProperty("ResponsePayload", "Printing Payload As Attachment")
messageLog.addAttachmentAsString("final" , builder.toPrettyString(), "text/plain");
message.setBody(builder.toPrettyString());
return message;
}
Thanks,
Marty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It does not look like you are passing correct input to this code. try and check your code here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Following! Interested with this topic. I would also like to know the answer to the question asked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.