Hanifa Shah Posted May 9, 2018 Posted May 9, 2018 I am searching for an ESP condition to pull through a custom field under the given scenario: In the progressive capture, I have given the customer an option to add a 'current job title' as well as a 'new job title' if applicable. I would like to pull through the new job title into an automated email, BUT if this is left blank, I would require an ESP condition to instead pull through the current job title. Is there an expression that would allow for this?
Victor Posted May 9, 2018 Posted May 9, 2018 @Hanifa Shah Assuming you would have, for example, Custom A to store the "New Job Title" and Custom B to store the "Current Job Title". To achieve this you need to chain two ESP conditions: That's how they look in the template: That's how they look if you inspect the "Source" of the template: <esp-condition contenteditable="false" expression="'{{.H_custom_a}}' != '' AND '{{.H_custom_a}}' != 'NULL'">{{.H_custom_a}}</esp-condition><esp-condition contenteditable="false" expression="'{{.H_custom_a}}' = '' OR '{{.H_custom_a}}' = 'NULL'">{{.H_custom_b}}</esp-condition> Make sure you have the expressions exactly as shown above, all quotes are very important 1
Hanifa Shah Posted May 31, 2018 Author Posted May 31, 2018 Hi, I have tried this and it doesn't seem to have worked. I have provided screen caps below for context, H_custom_d is the current job title and H_custom_m is the new job title. I would like the email to always pull in the current job title unless a new job title is provided, in which case, that should be pulled through instead When I tested your ESP conditions above, it was able to pull in the current job title, but failed to pull in the new job title when it was provided. When I inspected the source, this is the line of code that appeared <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' != '' AND '{{.H_custom_m}}' != 'NULL'">{{.H_custom_m}}</esp-condition><esp-condition contenteditable="false" expression="'{{.H_custom_m}}' = '' OR '{{.H_custom_m}}' = 'NULL'">{{.H_custom_d}}</esp-condition> this seems to match exactly to yours, Please could you advise.
Victor Posted June 1, 2018 Posted June 1, 2018 @Hanifa Shah 15 hours ago, Hanifa Shah said: it was able to pull in the current job title, but failed to pull in the new job title when it was provided. Hmm... a bit odd... it should have worked... I assume you tested this on a request...can you give me that request reference and the approximate time the automated email (which contains the job title) was sent? I woudl like to look at the event logs and see any possible reason why this failed...
Hanifa Shah Posted June 7, 2018 Author Posted June 7, 2018 I've just run another test the request reference is SR00041297 and the email was sent at 10:16am today. In this request I left the 'new position' field blank in the procap and expected the 'current position' to pull into the email.
Victor Posted June 7, 2018 Posted June 7, 2018 @Hanifa Shah thanks for the info, I'll have a look and get back to you...
Victor Posted June 7, 2018 Posted June 7, 2018 @Hanifa Shah right, I assume the template used in the above example is "RegradeFirstPoint". If this is right, then the expression used is incorrect. From what I can see, the ESP conditions for job details information in this template are currently: <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' != '' OR '{{.H_custom_m}}' != 'NULL'">{{.H_custom_m}}</esp-condition> <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' = '' AND '{{.H_custom_m}}' = 'NULL'">{{.H_custom_d}}</esp-condition> The AND/OR operators are the other way around The ESP conditions should be, as I advised above, like this: <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' != '' AND '{{.H_custom_m}}' != 'NULL'">{{.H_custom_m}}</esp-condition> <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' = '' OR '{{.H_custom_m}}' = 'NULL'">{{.H_custom_d}}</esp-condition> For Custom M we need to have the AND operator and for Custom D we need to have the OR operator. Your current template has them the other way around.
Hanifa Shah Posted June 11, 2018 Author Posted June 11, 2018 Hi, The email template used was actually RegradeFirstPointV2 which I believe the 'AND' and 'OR' are the correct way around. The source also seems to match what you have given above. I have logged another request under the reference SR00041850 and the email was sent today at 12pm.
Victor Posted June 11, 2018 Posted June 11, 2018 @Hanifa Shah right, seems there was one more scenario the expression did not cater for. So, try this in your ESP condition: <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' != '' AND '{{.H_custom_m}}' != 'NULL' AND SUBSTRING('{{.H_custom_m}}', 4, 10) != 'H_custom_m'">{{.H_custom_m}}</esp-condition> <esp-condition contenteditable="false" expression="'{{.H_custom_m}}' = '' OR '{{.H_custom_m}}' = 'NULL' OR SUBSTRING('{{.H_custom_m}}', 4, 10) = 'H_custom_m'">{{.H_custom_d}}</esp-condition>
Hanifa Shah Posted June 11, 2018 Author Posted June 11, 2018 Thank you, Tried this new ESP condition. This one also is able to pull through the new position, but when new position is left blank on the procap it does not pull through the current position instead, its just left blank Test request = SR00041939 time 14:55
Victor Posted June 11, 2018 Posted June 11, 2018 @Hanifa Shah can you please try again? I think there was something wrong with the text copied from forum (it put some hidden characters which broke the SUBSTRING syntax)...
Hanifa Shah Posted June 12, 2018 Author Posted June 12, 2018 Tried it again and still doesn't seem to work unfortunately. Test request SR00042090 Time 10.32am Template RegradeFirstPointV2
Victor Posted June 12, 2018 Posted June 12, 2018 @Hanifa Shah hmm... did some tests, something not right with the template source... the ESP conditions are fine, this is something else... looking into this.
Victor Posted June 12, 2018 Posted June 12, 2018 @Hanifa Shah - I have created a new template RegradeFirstPointV3, can you please try this one (amend your BP to use the V3)? I have checked the source and the conditions and they should be working fine... Not sure yet what happened in V2, possibly copy/paste of the condition syntax from forums added some invisible characters which corrupts the template source...
Hanifa Shah Posted June 12, 2018 Author Posted June 12, 2018 All seems to be working fine now! Thank you for all your help
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