Formula send two emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tinchux
    Junior Member
    • Dec 2021
    • 12

    Formula send two emails

    Hi I need some help, I have this chunk of code on my Formulas Entity. It sending two emails to "$mailAddress," . I must send only one. what am I doing wrong?

    Regards!

    Code:
    $contactId = array\at(contacts1Ids, 0);
    $mailAddress = record\attribute('Contact', $contactId, 'customEmail');
    $contactName = record\attribute('Contact', $contactId, 'name');
    debugMail = $mailAddress;
    ifThen(($mailAddress!='' && $mailAddress!=null),[INDENT]$id = record\create(
    'Email', //Email
    'from', 'mail@mydomain.com',
    'to', $mailAddress,
    'status', 'sending',
    'subject', 'testing mail',
    'body', string\concatenate($mailAddress,'-',$contactName,'-'),
    'isHtml', false
    );[/INDENT]
     );
    ext\email\send($id);
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    I think it is it do with with formula of your entity (seems the formula is triggered twice hence why the email is sent twice), check out the whole code of your formula. Also there is an issue with
    Code:
     ifThen(($mailAddress!='' && $mailAddress!=null)
    i think you should only stick with
    Code:
    ifThen(($mailAddress != null)
    Rabii
    Web Dev

    Comment

    • Vadym
      Super Moderator
      • Jun 2021
      • 345

      #3
      Hi tinchux,

      Please describe in more detail what logic you are trying to achieve?

      Comment

      Working...