Forum Discussion
You can use the $prev syntax within a field reference in Pipelines as a way to look at the prior value. You may have to get creative with your email but you can highlight the value of a field and its prior value using {{a.field}} and {{a.$prev.field}}.
What that means for your email is a little trickier - you could do something super generic like:
Field Value: Current: {{a.field}} / Prior: {{a.$prev.field}}
If you want a more styled email you'll probably have to get creative with doing {% if %} conditions to check if the value is different and then try and change the email accordingly.
------------------------------
Chayce Duncan
------------------------------
- HannahEngelson2 years agoQrew Trainee
This is a helpful start. Thank you!
------------------------------
Hannah Engelson
------------------------------ - HannahEngelson2 years agoQrew Trainee
Chayce, when able, could you give an example of what the if statement would look like? I was able to do the $prev and it works great. But I only want the fields that changed to show the previous vs new value.
------------------------------
Hannah Engelson
------------------------------- ChayceDuncan2 years agoQrew Captain
Sure - here is the full online documentation for using Jinja but also below:
{% if a.field != a.$prev.field %} {{ do something here }} {% endif %}
If you need to handle the else if condition you would do
{% if a.field != a.$prev.field %} {{ do something here }}
{% else %} {{do something else}}
{% endif %}
So if your values aren't the same you might just display {{a.field}} like:
{% if a.field != a.$prev.field %} {{ a.field }} {% endif %}
------------------------------
Chayce Duncan
------------------------------- HannahEngelson2 years agoQrew Trainee
You are a rockstar! I have bookmarked the Jinja link you sent as well. It's a very new language for me. Thank you so so much for this.
------------------------------
Hannah Engelson
------------------------------
Related Content
- 3 months ago
- 9 months ago
- 2 months ago
- 3 months ago