Announcement

Collapse
No announcement yet.

Formula to create multiple Contact Phone Numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Formula to create multiple Contact Phone Numbers

    How can I fill 2 values under each other/highlighted in blue in emailAddress in Contact Entity from Lead Entity with record\create ? The Lead record has 2 custom fields: personalEmail and professionalEmail that I need to fill in/create/copy to emailAddress (1 field in Contact)
    Code:
    record\create(
       'Contact',
       'firstName', firstName,
       'lastName', lastName,
       'emailAddress',list(personalEmail, professionalEmail)
    );
    The formula is only creating the firstName and lastName fields in Contact from the Lead Entity
    Last edited by JosNas; 11-05-2021, 03:01 PM.

  • #2
    Thank you in advance for any help

    Comment


    • #3
      Hi JosNas,

      Unfortunately, this logic is not yet available.
      As a workaround, you can create a custom text type field (e.g. "addEmails") and fill it with the Formula:
      Code:
      $personalEmail = record\attribute('Lead', '618ce6c4a2e55b7a8', 'personalEmail');
      $professionalEmail = record\attribute('Lead', '618ce6c4a2e55b7a8', 'professionalEmail');
      firstName = record\attribute('Lead', '618ce6c4a2e55b7a8', 'firstName');
      lastName = record\attribute('Lead', '618ce6c4a2e55b7a8', 'lastName');
      addEmails = string\concatenate('personal email : ', $personalEmail, ' | ', 'professional email : ', $professionalEmail);
      *618ce6c4a2e55b7a8 - Lead ID

      Documentation:
      https://docs.espocrm.com/administrat...ecordattribute
      https://docs.espocrm.com/administrat...ingconcatenate
      Attached Files
      Last edited by Vadym; 11-12-2021, 01:56 PM.

      Comment


      • #4
        Hello Vadym, thanks for the help I still need to try it asap and I'll post again here. Just 1 question how can I get the ID of the Lead? Thanks again!
        Last edited by JosNas; 11-12-2021, 08:48 AM.

        Comment


        • #5
          Hi JosNas,

          A bit edited. I hope it's clearer now.

          'personalEmail', 'professionalEmail' are Lead entity custom varchar-type fields.
          $personalEmail, $professionalEmail are variables to which assign the values of 'personalEmail', 'professionalEmail' fields,
          and then record them in the addEmails field.

          Comment


          • JosNas
            JosNas commented
            Editing a comment
            Great! It works thank you! Is there a way to get the ID of the Lead so I don't have to enter it manually (hardcoded) ? I'm using a workflow to do this for every Lead

        • #6

          I suppose that’s what you need.

          Code:
          $memberId = record\findOne('Contact', 'createdAt', 'desc', 'firstName=', firstName, 'lastName=', lastName);
          $firstName = entity\attribute('firstName');
          $lastName = entity\attribute('lastName');
          $personalEmail = entity\attribute('personalEmail');
          $professionalEmail = entity\attribute('professionalEmail');
          $addEmails = string\concatenate('personal email : ', $personalEmail, ' | ', 'professional email: ', $professionalEmail);
          ifThen(
          $memberId == null,
          record\create('Contact', 'firstName', $firstName, 'lastName', $lastName, 'addEmails', $addEmails)
          );

          Comment


          • #7
            Is this formula still working?

            Comment


            • espcrm
              espcrm commented
              Editing a comment
              I would assume so considering this thread is barely a month old... you could give it a try and if there is an error you can ask.

            • JosNas
              JosNas commented
              Editing a comment
              hey jordan I am 99% sure it is. I just haven't been able to try it yet which is why I haven't replied here but I will today.
          Working...
          X