Support » Plugin: Brilliant Web-to-Lead for Salesforce » Convert the email address to lowercase?

  • Resolved mapperkids1

    (@mapperkids1)


    Hi,

    Is that any easy way I can convert the email address field on the form to lowercase?

    Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nick Ciske

    (@nickciske)

    Define “easy” 😉

    Adding this to functions.php or a custom plugin should do the trick. Make sure to edit the form ID and field name if needed.

    
    // Lowercase an email
    
    add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_lowercase_example', 10, 2 );
    
    function salesforce_w2l_field_value_lowercase_example( $val, $field ){
    
        $form_id = 1; // form id to act upon
        $field_name = 'email'; // API Name of the field you want to auto check
    
        if( $form == $form_id && $field_name == $field ){
            return strtolower( $val );
        }
    
        return $val;
    
    }
    

    Hi Nick,

    Thanks for the quick reply and that sounds easy, I shall just put into the function.php in WP, one more question can I apply the rule to all forms and not just specific form id?

    Thanks a lot!

    Plugin Author Nick Ciske

    (@nickciske)

    All forms

    // Lowercase an email
    
    add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_lowercase_example', 10, 2 );
    
    function salesforce_w2l_field_value_lowercase_example( $val, $field ){
    
        $field_name = 'email'; // API Name of the field you want to auto check
    
        if( $field_name == $field ){
            return strtolower( $val );
        }
    
        return $val;
    
    }

    Hi Nick,

    It makes sense to me, I put it at the end of the function.php, for some reason it is not working (without error), in SF still showing some uppercase character in the email address unless I go it and re-save the lead, but that is because SF converted to lowercase for all email address by default.

    Any idea?

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.