Hi,
I want to check if the word 'POST' comes back in a contextual attribute: {{context.journey.events.00000._company.igOrder.igEntries.CarrierUid}}
So I want this:
If {{context.journey.events.00000._company.igOrder.igEntries.CarrierUid}} contains the word 'Post' ( not case sensitive), I want to show: "Post bezorging" in the e-mail.
I know how to use the if statements, but the documentation is totally not clear about how to use the contain function.
Can someone help me with this?
Thanks!!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Thanks for all your help!
It turned out that the field was an array, so I have to use the each function first. Did that and then it worked
Hello @Taal
You can do it like this.
{%#if(contains(context.journey.events.00000._company.igOrder.igEntries.CarrierUid, "post", false)) %}
If field containss post print something
{% else %}
Post not found in the field
{%/if%}
More info on function is available here: String functions library | Adobe Journey Optimizer
Thanks @_Manoj_Kumar_ I am going to try this!
Views
Replies
Total Likes
Hi, I tried these two ways, but they don't work. Do you know how else I could try it? Thanks for your help! @_Manoj_Kumar_
Views
Replies
Total Likes
@Taal remove the single quote around the event id
content.journey.event.'816428911'
Views
Replies
Total Likes
Just tested it. That won't work either.
It seems all these functions are designed to work independently. If we wrap them within other functions they are not working.
Views
Replies
Total Likes
Maybe try this? single quotes and little change in format.
if contains({{context.journey.events.00000._company.igOrder.igEntries.CarrierUid}}, 'Post') {
// email
}
Views
Replies
Total Likes
Hi,
Thanks for all your help!
It turned out that the field was an array, so I have to use the each function first. Did that and then it worked
Views
Replies
Total Likes
Sure!
Note that the field that I use is an array, so if your field is not an array, you should not use the 'each' part:
{{#each context.journey.events.xxxxxx._company.igOrder.igEntries as |entry|}}
{%#if contains(entry.CarrierUid, "post", false) %}PostNL{%else if contains(entry.CarrierUid, "zzz", false)%}zzz{%else%}
External {%/if%}
{{/each}}
Views
Likes
Replies