Calculated field for If/then statement

We have built a field on the Company Module for "Billing Email Address". On the quote Module, I have created a calculated field that pulls in that data (related($billing_accounts,"billingemailaddress_c").

However, if the company module billing email field is blank, we would like it to populate with the data from the Quote Contacts Email address ($billing_contact_email_c) that is listed on the quote. 

So, it will default to the billing address from the Company module but if there isn't one, it will populate with the email address of the contact on the quote. 

Is there a quick and easy solution to this? 

  • Hi Norm Bonenfant,

    ifElse(greaterThan(strlen(related($billing_accounts,"billingemailaddress_c")),0),related($billing_accounts,"billingemailaddress_c"),related($billing_contacts,"billing_contact_email_c"))

    I hope this helps!

  • Hello Patrick. 

    Thank you so much for sending this over. While it did not work, it got me a big step in the right direction. I was close but did not have enough parenthesis in the equation on mine. Unfortunately, since the Formula Builder does not include email addresses int he related fields for Company or Contact, including the field name did not work. The way to get the email address is "email1" so the final formula ended up:

    ifElse(greaterThan(strlen(related($billing_accounts,"billingemailaddress_c")),0),related($billing_accounts,"email1"),related($billing_contacts,"email1"))
    This seems to work just fine. 
    Anyway, if I ever see you in a bar, I owe you a beverage!