Monday, October 5, 2015

Forward (Email) the received Attachment via UMS Adapter


Note : This post assumes that you already have some working knowledge of BPEL and XSLT functions and you're able to retrieve the content of Email attachment as described in my previous post - UMS Adapter - All about email attachments.

There may be cases when you have received an email attachment via UMS Adapter and you want to forward the same email as-is to another recipient e.g. if received attachment is invalid then forward to same to support team for further diagnosis. Following instructions show how you can achieve the same.

  • Drag and Drop another UMS Adapter (because the one you may have already was used to originally receive the Email) onto the right swimlane and select Outbound Send Notification in the Operation Type . Also check Receive Message Id as Reply . Click Next.
  • On the next screen choose Type of notification = Email and assign appropriate Subject and To Email ID. You can leave From as blank. Click Next.
  • Choose Message is of String type . Click Next and Finish.
  • Now drag and Drop an Invoke activity and connect to the UMS Adapter which will allow to create Input/Output variables e.g. InvokeSendErrorNotification_InputVariable and InvokeSendErrorNotification_OutputVariable
  • Now drag another Assign activity and place it just before the Invoke just created.
  • Assign relevant text for payload string to InvokeSendErrorNotification_InputVariable > body > message > payload . You can also use html formatted text if you wish in the payload.
  • Not navigate to InvokeSendErrorNotification_InputVariable > body > message > attachment > href and assign the incoming attachment href variable (ReceiveEmail_InputVariable). This variable was created as part of Receive activity when we configured previous UMS Adapter to receive the incoming email and attachment. Click OK and that's it.

The code for Assign activity is shown below for guidance.

  • First from expression - the payload that you want to appear as the email message. This is html formatted just to show how you can use html formatted tags.
  • InvokeSendErrorNotification_InputVariable.body/ns7:payload - Input variable created as new UMS Adapter. We're assigning into payload element of the same.
  • $ReceiveEmail_InputVariable.body/ns2:attachment[1]/@href - variable created from previous UMS Adapter to receve the attachment. [1] is used to refer to the first attachment in the email in case received email has multiple attachments.
  • $InvokeSendErrorNotification_InputVariable.body/ns7:attachment/@href - the variable created as part of new UMS Adapter. We're referring to the @href here which contains the reference to the attachment.

Happy Learning and let me know if any doubts!

1 comment:

  1. I have been reading your posts regularly. I need to say that you are doing a fantastic job. Please keep up the great work.
    binary option tips