How to check if contact's email address is not empty in process definition?

Hello devs,


I have a process definition to send an automated email to the specified contacts if certain conditions are fulfilled. I have been receiving a lot of exceptions in my sugar log regarding the email address missing while attempting to send an email. I need to know a way to eliminate contacts without an email address. I couldn't find the email field for selection in the process definition. Please help.


Regards.
Hatim

Parents
  • Hello  

    To address the situation, you could implement a flag system to indicate whether a Contact possesses an email address.
    Here's a step-by-step approach to achieve this:

    1 - Create a Checkbox Field:

    In Studio, create a calculated checkbox field in the Contacts module named "hasemailaddress_c"  with the following formula 

    not(equal(related($email_addresses,"email_address"),""))


    2 - Utilize the Checkbox in Your Process Definition:

    After saving the checkbox field, incorporate it within your Process Definition.
    Specifically, you can use it in an exclusive gateway to filter out Contacts that do not have an email address.




    Let me know if this helps. 

    André 

  • Thank you  .

    Is there no OOTB way without creating a custom field? Please let me know.

  • Hello  , 

    Thanks for the challenging reply. 

    There is actually another approach that might be better without creating a custom field. 
    You could create a Business Rule to evaluate the Email Address of the Contact and then place it before your Exclusive Gateway: 


    Let me know if this one works for you. 

    Cheers, 

    André 

  • Hopefully you don't mind me adding a further question on the business rule...  I am looking at a very similar situation and found this thread.

    We have a username field on the contact record. (used for customers logging into our website/s)
    I want to create a process definition to do the following:

     - When a New Contact record is created 
    and Email is not empty
    and username is empty.   

    >>>  Add Email into Username.
       

    But - In the PD start event, Email (email address) is not available to select?   
    Do you know how to get to the related email address?  ("email1" I believe).
       


      
    So, I then looked at it another way.

    Start Event: New contact created and username is empty.

     > Business rule > Email is not empty.  Return value = email.

     > I then evaluate the BR,
    but how after that do I take the value returned from the BR (the email if it was there) and shove that into my username field???    
    I cant seem to select it from the BR in the next Action Event (Change field) ?

    Hopefully that makes sense...  I added an image below with PD all marked up to help show where I am stuck on adding the email address:

    Many thanks Pray

    EDIT to add...  in a report I can simply traverse: 

    Contacts > Email Address (module) > Email Address.

Reply
  • Hopefully you don't mind me adding a further question on the business rule...  I am looking at a very similar situation and found this thread.

    We have a username field on the contact record. (used for customers logging into our website/s)
    I want to create a process definition to do the following:

     - When a New Contact record is created 
    and Email is not empty
    and username is empty.   

    >>>  Add Email into Username.
       

    But - In the PD start event, Email (email address) is not available to select?   
    Do you know how to get to the related email address?  ("email1" I believe).
       


      
    So, I then looked at it another way.

    Start Event: New contact created and username is empty.

     > Business rule > Email is not empty.  Return value = email.

     > I then evaluate the BR,
    but how after that do I take the value returned from the BR (the email if it was there) and shove that into my username field???    
    I cant seem to select it from the BR in the next Action Event (Change field) ?

    Hopefully that makes sense...  I added an image below with PD all marked up to help show where I am stuck on adding the email address:

    Many thanks Pray

    EDIT to add...  in a report I can simply traverse: 

    Contacts > Email Address (module) > Email Address.

Children