Expand my Community achievements bar.

Join us for the Community Q&A Coffee Break on May 2nd at 8 am PT with Adobe Journey Optimizer experts Robert Calangiu, Brent Kostak & Sandra Hausmann.
SOLVED

How to check if an field is empty in a condition

Avatar

Level 3

Hi,

 

We send out order confirmations and order ready at pick up location.

We don't have the pick up location address en name available in the order ready at pick up location event, so what we do is this:

In the order event, we write the pick up location to the profile and in the ready at pick up location e-mail we retrieve those fields from the profile to show them in the e-mail.

It looks like this for the company name:

 

{% let igCompany = "" %}

{%#if contains(profile._clientname.igOrderEventsCollection, context.journey.events.`1154443460`._clientname.igOrder.igUid, false) %}

{% let igCompany = regexGroup(profile._clientname.igOrderEventsCollection,concat(context.journey.events.`1154443460`._clientname.igOrder.igUid,"\\.igHomeDeliveryAddress.igCompany=(.*?);"),1) %}

{%/if%}

 

Then we can use the pick up location name in the e-mail as this: {{igCompany}}

 

But sometimes we have special order were we don't have a order event for, but we do get a ready at pickup location events.

We don't want to send out e-mail for those cases, since we don't have the pick up location details available.

 

So my question: how can we make a condition in the journey that checks if {{igCompany}} is empty? We probably do need to state the let statements too:

{% let igCompany = "" %}

{%#if contains(profile._clientname.igOrderEventsCollection, context.journey.events.`1154443460`._clientname.igOrder.igUid, false) %}

{% let igCompany = regexGroup(profile._clientname.igOrderEventsCollection,concat(context.journey.events.`1154443460`._clientname.igOrder.igUid,"\\.igHomeDeliveryAddress.igCompany=(.*?);"),1) %}

{%/if%}

 

 

Can someone help me? 

 

Talitha 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Taal, In the condition activity of the journey, you can use the contain function in advanced expressions to check for this condition.

 

Something like this

Manoj_Kumar__0-1683605325051.png

 


     Manoj
     Find me on LinkedIn

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @Taal 

 

If you do not want to send an email in this case then you can use the condition in the journey.

 

Something like this:

Manoj_Kumar__0-1683417773962.png

 

If you do not want to print the company name then you can use a condition like this.

 

{%#if isNotEmpty(companyId)%} 
print company name
{%/if%}

     Manoj
     Find me on LinkedIn

Avatar

Level 3

Hi Manoj,

 

Thanks for your reply.

 

The first option is impossible since I can only use the field in the advanced expression.

The second option isn't possible either, since I don't want to send the e-mail at all if no company name is available. 

 

Avatar

Correct answer by
Community Advisor

Hello @Taal, In the condition activity of the journey, you can use the contain function in advanced expressions to check for this condition.

 

Something like this

Manoj_Kumar__0-1683605325051.png

 


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

You can use also use isEmpty and isNotEmpty functions for validation. Both are available in advanced expressions


     Manoj
     Find me on LinkedIn

Avatar

Level 1

how can we check the Isempty with date field as i am getting syntax error?

Avatar

Community Advisor

@ReagonEx, This is an example with date field, 

#{ExperiencePlatform.ProfileFieldGroup.profile.person.birthDate} is null 

Thanks, Sathees