cancel
Showing results for 
Search instead for 
Did you mean: 

Sending an Email from UDF if incoming file is empty

Former Member
0 Kudos

Hi All,

My scenario is :

File -XI- File

My requirement is if incoming file is empty then XI should send email to a recipients list with a custom message saying that "No Error Records".

Where should be the logic to send this email?

Should I create an UDF to send this email in the mapping(at the root node)?What should be the code in the UDF(to send email)?

Can anybody please help me for this scenario?

Thanks in advance!

Shweta.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Shweta,

Sending mail is not possible via UDF.

But in case if the empty condition is failed then you could create the Mail communication channel and use it with conditional routing in Receiver determination.

1. Create two Business services one for receiver File and one for receiver Mail.

2. Now in Receiver dtermination..open the Conditional editor where check if the fields are empty...

3. If its empty recevier mail adapter will be called and Notification mail will be passed with required information.

4. If the values are avaialble in field then the File to File scenario will be executed.

Thanks

Swarup

ranjit_deshmukh
Active Participant
0 Kudos

Hi,

Sending mails through UDF is possible.

please see the javamail api documentation

http://java.sun.com/products/javamail/javadocs/index.html

But the simple option is to use the conditional receiver Mail adapter.

Ranjit

prateek
Active Contributor
0 Kudos

It is not possible using UDF.

Instead of File to File make it File to Email and File both. For this use multiple receivers in the Receiver Determination step.

1. U may create a simple message type with a single field "Text" and map a constant to it "No Error Records".

2. Now perform multimapping, with two receiver message structures, one of file and otehr for mail as suggested in step 1

3. Based on this u may perform the interface determination.

Regards,

Prateek

ranjit_deshmukh
Active Participant
0 Kudos

Hi Shweta,

I am trying to post the reply to your post , unfortunately I can not do it because of rules of engagement- even though there is not any inappropriate content.

I think you can not get any reply in that case, sorry!

Ranjit