Have created a process which needs to send Emails. In this email, I need to format the text based on some variable i.e. I have tried to use if/else conditions using Javascript. But this is not working for me. My question is , can I java-script inside mail task body ? If not, then is there any other way of formatting the text .Here is what am trying to do inside the “html” attribute of Mail-task : -
Hello Solution Delivery Team
A new request has been submitted with the following details :-
I’m not entirely clear what you’re trying to do, but you can use variables to insert whatever simple html content you want. I think you could have the process set the content through conditional flows or script tasks and just have an html attribute with a value something like “${emailTop}<br><p>Constant content</p>${emailBody1}<p>More constant content</p>${emailBody2}<br>${emailFooter}”, with the variables also containing simple html, e.g. emailTop = “<h1>Hello!</h1>”.
Thanks @PHH for replying. What am trying to achieve is Format the text e.g. (as per your example ) I want ${emailBody2} to appear only if its NOT NULL i.e. something like
if(null != ${emailBody2} ) { Email Body 2 is : ${emailBody2}
}
No. An alternative could be to have a java service tasks that prepares this text in Java and stores it as a transient variable that’s referenced in the mail task.