on 2022 Apr 20 4:23 PM
Hi EveryOne,
I have an iflow, when there is an exception it is handled via the exception subprocess and the error details are generated as attachments as shown below.
Now I have to send a mail regarding the error details.
My requirement is
1. Can I fetch the attachment named "ODataV2_Adapter_Response_Body" in my iflow ? If yes, please provide a solution for this.
2. In the attachment "ODataV2_Adapter_Response_Body" I have to use a particular field and send that to mail.
for example:
the above image contains the payload of the "ODataV2_Adapter_Response_Body" attachment. I need to fetch the field called "value" located in the "error/code/message" node. Is it possible to fetch this value? please provide a solution for the above requirement.
Thank You,
Vineetha.
Request clarification before answering.
Hi Vineetha,
1st use groovy script to get the response body in exception sub process block.
Then you can parse the json and send it.
import com.sap.gateway.ip.core.customdev.util.Message;
import groovy.json.JsonSlurper;
def Message processData(Message message) {
def map = message.getProperties();
def ex = map.get("CamelExceptionCaught");
if (ex!=null) {
if (ex.getClass().getCanonicalName().equals("com.sap.gateway.core.ip.component.odata.exception.OsciException")) {
def resp = message.getBody(String);
def json = new JsonSlurper().parseText(resp);
def value = json.error.message.value;
message.setProperty("errorVal", value);
}
}
return message;
}
Then you access that errorVal property in email body using expression ${property.errorVal}
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.