Jump to content

Recommended Posts

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?

Link to comment
Share on other sites

@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:

image.png

That's how they look in the template:

image.png

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 ;) 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

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. 

image.png.7d181b506f37b83634b7885f87e25f52.png

image.png.38988117db38f93d7c52884b41d29064.pngimage.png.24046b9e08c1d14dd4c3787413f586df.png

 

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. 

Link to comment
Share on other sites

@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...

Link to comment
Share on other sites

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. 

image.png.4ece91fed60f2a4c7a03a2f907a7f8da.png

 

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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. 

 

 

Link to comment
Share on other sites

@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>

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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...

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...