Sending email conditionally

Hi!

I am using the Trading Networks 6.0.1. In the Processing Rules-Action-Alert EMail section, i would like to send an email only if their is a failure and not always.
Is it possible to implement the same in some form.

regards,
sandip

I believe its not possible using that processing Rules-Action-Alert Email functionality when failure occurs,So,you need to trigger a custom service and do error handling logic and invoke smtp service for sending email Alerts inside that custom service depending on the failures.

Generally every body follows this type of scenario for generating system Email alerts.

HTH.

Hi Sandeep,

If it is related to the error within the service invoked from the processing rule, you have to do as what HTH has indicated.

If it is related to the error in the document itself, you could create a new processing rule, place this as the first processing rule, and call the alert email here and not the standard email.

Alternatively, you could trap the exception event and send an error email. You could also try if putting the email address in the IS server helps you in all your cases. Else the alternative is to write your own service.

-Rajesh Rao

RMG,

I thought ur idea before but then i thought something might be done inside TN.
Ok, i am curious to know one more thing, say if i write a customer Java service and set all the body and subject of email fields inside the same. I can hardcode the to field also inside the service.
Is their any better way to handle such variables or hard coding in the java service is the best possible way for such implementation.

Let me know if any other alternative exist.

bye
sandip

You can try using flow service itself and depends on deep customization then use java service.

Regarding hardcoding of values as you mentioned,no need to hardcode explicitly if any error occurs try to use pipeline variables and set accordingly to email body using perform variable substitution or direct mapping of errorRecord (since its not best practice to depend of hardcoding technique).

HTH.

RMG,

Well yes, i am using Flow Service. Only to populate the body of the email message i need to use the Java Service which would create the body and store it in a variable. Then i would use that variable to populate the smtp variable.
If i need to write in the body say combination of static string, variables, is their any way i can do it from the Flow Service, and Transformers. I see the best possible way is to use concat but then it only allows 2 input string.
And if i use pub.string.makestring, i need to assign it to variables the static string and then go ahead.

Please suggest.

bye
sandip

RMG,

I understood what u meant. I tried to use pub.stirng. makeString. I can just write the static string also in the list.

thanx
sandip

Once you have the static string,variables in the pipe,you can do a setValue in Body param of smtp service(for eg: Error :%static string%, Message:%message%,Severity:%severity%…etc)and check the
perform Variable Substitution (checkbox),so that you can get rid of concat,makestring services…

And format it visually on Email body.

Hope you got my point…

HI RMG,

I’m using SAP BC 4.6 and i’m trying to send email to our customers thru smtp services.I have all the strings and variables in the pipeline.How do i format the email body, because the body param of smtp service is just a line of string.

Thanks in advance.
raj

Raj,

please see my above post the work around.

you have do a setValue of the body param and check Variable Substitution on and place the strings(variables in the pipeline example message) then do this way %message%.So the actual message value will be showup in the body of the email.

HTH,
RMG.