Autofill Field based on other field value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • william34
    Junior Member
    • Jun 2023
    • 21

    Autofill Field based on other field value

    Hi,

    I been working on create Lead form.
    How can I make 'website' field auto detect and filled from email field.

    Like if email is input as test@example.com
    then website should be auto set to example.com
    Last edited by william34; 06-25-2023, 02:11 PM.
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    you can use formula to do it, this formula below it does it for an account (i have added a condition if the record if new and there is no website OR if the email address has changed) you can changes these conditions as you want

    PHP Code:
    ifThen(entity\isNew() && !website || entity\isAttributeChanged('emailAddress'),
    
        $email = emailAddress; // Assign the emailAddress to a variable for readibility (optional)
        $parts = string\split($email, "@"); // Split the email address into parts
    
        ifThen(array\length($parts) > 1, website = array\at($parts, 1))
    )
    I hope this helps
    Rabii
    Web Dev

    Comment

    • william34
      Junior Member
      • Jun 2023
      • 21

      #3
      Hi rabii,

      Is there other way? I have set Duplicate check based on Country and Domain now.
      Duplicate check seems to fails. When Domain is fetch from email with formula.
      Last edited by william34; 06-26-2023, 11:44 AM. Reason: Edited : I meant Duplicate Check

      Comment


      • rabii
        rabii commented
        Editing a comment
        what do you mean by (Duplicate check seems to fails. When Domain is fetch from email with formula.) ? as i understand you have now a duplicate check that checks both country and domain (i assume if the country or domain already exist on another record then the duplicate check modal would show up).

        so what is the issue when using the formula ?
    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #4
      what do you mean ? duplicate validation ? do you mean duplicate check ?
      Rabii
      Web Dev

      Comment


      • william34
        william34 commented
        Editing a comment
        yes Duplicate Check
    Working...