Martyn Houghton Posted September 5, 2017 Posted September 5, 2017 At the moment when using a variable in an Email Template, the system will correctly insert the value when the field has a value, but when it is empty/null the email has the variable name inserted rather than just inserting nothing. Could the system be changed so when the variable is blank nothing is inserted or if not, perhaps an option to include a standard value such 'No set' or 'No Value'. Cheers Martyn
James Ainsworth Posted September 5, 2017 Posted September 5, 2017 Hi Martyn, I believe that there is a way to set this up. I'm not too familiar with it myself but here is the wiki page that describes this. I will try to have a look myself, but to let us know if the documentation helps and if you are able to set this up before I get back to you. Regards, James
SJEaton Posted September 6, 2017 Posted September 6, 2017 Hi @Martyn Houghton See my topic on this as I was given a solution Sam
Martyn Houghton Posted September 6, 2017 Author Posted September 6, 2017 @James Ainsworth @SJEaton Thanks for the guidance, which does get around the problem of the variable name being inserted, just that it would be good if this was done automatically by the product, given that you have to do this for each variable that may be empty. When you are creating and maintaining a large number of templates this does seem unnecessary. Cheers Martyn
Martyn Houghton Posted September 6, 2017 Author Posted September 6, 2017 @James Ainsworth Just to follow this up, the ESP Expression only work in the body of the email. If you want to include a field on the subject line, such as we do the customer reference which may be supplied or may be blank, the expression does not work and you still get the variable name inserted. Therefore at the moment we are not able to include the customer's reference in the subject line. Cheers Martyn
SJEaton Posted September 6, 2017 Posted September 6, 2017 Oh ok, we didn't need it for the subject line so it suited our purposes. Sorry it couldn't help Sam
Martyn Houghton Posted October 9, 2017 Author Posted October 9, 2017 @James Ainsworth This is becoming an issue for us with email integration with third parties as they require the reference to be in the subject line and it is not possible to use a different email template from the request email option as there is no option to override the subject line or template. We could get around this if we could include the custom field on the subject line in the template which would be blank most of the time, but cannot do this at the moment as the field name will get inserted instead. Cheers Martyn
TrevorKillick Posted October 10, 2017 Posted October 10, 2017 @Martyn Houghton Have you taken a look a Email Template Variable Modifiers? https://wiki.hornbill.com/index.php/Email_Templates You can add |empty inside the {{ }} variable markup and this will remove the variable if it does not have a value, removing the requirement to use ESP Conditions and these modifiers will work in the subject of the email. Like this: {.h_variable}} {{.h_variable|empty}} Kind Regards Trevor Killick
Martyn Houghton Posted October 10, 2017 Author Posted October 10, 2017 @TrevorKillick Thanks for pointing us the direction of the above. I give that a try ASAP. Cheers Martyn 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now