mautic-extended-field icon indicating copy to clipboard operation
mautic-extended-field copied to clipboard

(BUG) Form field value is not mapped to (extended) custom field in existing contact profile

Open albanleandri opened this issue 6 years ago • 2 comments

Description : The functionality to map a form value to an extended custom field is broken when the contact already exists in Mautic. It's a problem for migrating an existing system's custom contact field to extended contact fields.

Mautic : v2.12.2 PHP : PHP Version 7.0.27

  1. Set as follows

image

  1. Create 2 custom fields : 1 normal / 1 extended (I haven't tried secure extended)

image

  1. Create a form with 2 text fields, and map the value of each to the previously created contact & extended custom fields

image

  1. Submit the form with a value in each field (and use the email of an existing contact whose profile already exists in Mautic)

image

  1. Observe the form results (it should be as expected)

image

  1. Check contact profile

image

LOG : It seems (without certainty) that the following log errors relates to this issue:

[2018-07-17 04:46:41] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: "An exception occurred while executing 'SELECT DISTINCT f.title AS title FROM lead_fields l WHERE (f.title <> '') AND (f.title IS NOT NULL) ORDER BY title ASC LIMIT 10 OFFSET 0': SQLSTATE[42S22]: Column not found: 1054 Unknown column 'f.title' in 'field list'" at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 71 {"exception":"[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing 'SELECT DISTINCT f.title AS title FROM lead_fields l WHERE (f.title <> '') AND (f.title IS NOT NULL) ORDER BY title ASC LIMIT 10 OFFSET 0':\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'f.title' in 'field list' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:71, Doctrine\DBAL\Driver\PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'f.title' in 'field list' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:106, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'f.title' in 'field list' at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104)"} []

Note : If you use in the form the email of a new contact (never added to Mautic before), then it will create this contact and the mapping will work well.

image

albanleandri avatar Jul 17 '18 03:07 albanleandri

Hi @heathdutton I have been able to replicate this on 2.14. I am using a form and I try to map some text field value to a custom field with object type "extended" and type "text", but the value of my extended custom field remain empty, as described above. The issue is only for updating existing contacts, not for a newly created contact (new email passed in the form).

albanleandri avatar Aug 07 '18 16:08 albanleandri

I pushed a fix today that addresses the "select DISTINCT f.title..." error. Does this also fix this issue for you?

scottshipman avatar Aug 15 '18 15:08 scottshipman