Announcement

Collapse
No announcement yet.

FlowChart check duplicates

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

  • FlowChart check duplicates

    Hello,

    I am trying to get update a specific lead, and check if there is already duplicate who has the same phone or email, I am still a little bit new to the flowchart formulas.

    How can I check for duplicates by phone or number in the BPM flowchart?

    Many Thanks!

  • #2
    check this out https://docs.espocrm.com/development/duplicate-check/

    Comment


    • #3
      You can utilize formula record\exists function. Assign the result of the function to a variable. Then check the variable value in a gateway element. If the variable is not empty, it means there's a duplicate.

      In a Script Task:

      Code:
      $phoneNumber = entity\attribute('phoneNumber');
      $emailAddress = entity\attribute('emailAddress');
      
      $hasDuplicate =
          ifThenElse(
              $phoneNumber,
              record\exists('Lead', 'phoneNumber=', $phoneNumber),
              false
          ) ||
          ifThenElse(
              $emailAddress,
              record\exists('Lead', 'emailAddress=', $emailAddress),
              false
          );
      Last edited by yuri; 12-25-2021, 10:22 AM.

      Comment


      • #4
        I try this code on gateway element, it doesn't work, what am I doing wrong?

        Code:
        $phoneNumber = entity\attribute('phoneNumber');
        
        $hasDuplicate =
        ifThenElse(
        $phoneNumber,
        record\exists('Lead', 'phoneNumber=', $phoneNumber),
        false
        );

        Comment


        • rabii
          rabii commented
          Editing a comment
          remove the semi-colon and try again.

      • #5
        does not work

        I want to check using BPM for matches by phone number when creating and launch an additional action based on the result of the check, if anyone has a solution, please share
        Last edited by alexisc; 04-22-2022, 11:03 AM.

        Comment


        • #6
          In condition there should be only one expression. You could use the formula before the gateway in the script task, and then check only variable in the gateway (as variable is an expression too).

          Or try this in gateway:

          Code:
          ifThenElse(
              entity\attribute('phoneNumber'),
              record\exists(
                  'Lead',
                  'phoneNumber=', entity\attribute('phoneNumber'),
                  'id!=', entity\attribute('id')
              ),
              false
          );
          This is a single expression.

          Comment


          • #7
            this formula works, thank you very much!!!

            Comment

            Working...
            X