No auto-fill of the COMPANY FIELDS in the Mautic form

Your software
My Mautic version is: v2.15.3
My PHP version is: 7.2.21-1

Your problem
My problem is: When an existing contact with an assigned company gets to a Mautic landingpage, the data of the CONTACT FIELDS are automatically filled in the Mautic form. But not the assigned COMPANY FIELDS of this contact. The COMPANY FIELDS in the form are still blank.

These errors are showing in the log: No log file

Steps to reproduce

  1. Create a landingpage with a form and the fields “contact name, company name and company street”
  2. Create an email with a link to this landingpage
  3. Send an email to an existing contact with an assigned company
  4. The CONTACT FIELD “contact name” is correctly auto-filled. The COMPANY FIELDS “company name” and “company street” keep wrongly blank. (Wrongly, because the data of the company name and company street already exist in the Mautic database)

Any solution to this? @jorgedeviena

You might be able to add logic for this on client side if you extend mautic tracking script (add custom functionality to mautic).

If above does not work, yo can always add additional JS directly to page and on mautic end just add endpoint your calling to get data for company.

Although I would have some questions, what do you do if one contact has multiple companies (which one do you choose)?

Based on my tests this is still an issue in Mautic 4.4.6

I also found this issue that was closed due to inactivity: No auto-fill of the COMPANY FIELDS in the Mautic form · Issue #8400 · mautic/mautic · GitHub

@npracht raises a good question in the issue. How do we deal with contacts that are members of multiple companies.

Edit1:
After some further investigation: the code already has a method that gets the values from the primary company getProfileFieldsWithPrimaryCompany()

So we could use that to auto-fill the company values from the primary company.

Edit2:
I created a PR for this. Please test it: Pre-Fill the primary company values in the form if they are mapped by adiux · Pull Request #12635 · mautic/mautic · GitHub