Closed steverowling closed 2 months ago
I've looked into this further and if I comment out the following lines in the verbb\formie\base\SubField.php
class, the field mapping works as expected:
protected function defineValueAsString(mixed $value, ElementInterface $element = null): string
{
// Bubble-up to the main field method, as we don't want to use `SingleNestedField` definitions
return Field::defineValueAsString($value, $element);
}
protected function defineValueAsJson(mixed $value, ElementInterface $element = null): mixed
{
// Bubble-up to the main field method, as we don't want to use `SingleNestedField` definitions
return Field::defineValueAsJson($value, $element);
}
protected function defineValueForExport(mixed $value, ElementInterface $element = null): mixed
{
// Bubble-up to the main field method, as we don't want to use `SingleNestedField` definitions
return Field::defineValueForExport($value, $element);
}
protected function defineValueForSummary(mixed $value, ElementInterface $element = null): string
{
// Bubble-up to the main field method, as we don't want to use `SingleNestedField` definitions
return Field::defineValueForSummary($value, $element);
}
protected function defineValueForIntegration(mixed $value, IntegrationField $integrationField, IntegrationInterface $integration, ElementInterface $element = null, string $fieldKey = ''): mixed
{
// Bubble-up to the main field method, as we don't want to use `SingleNestedField` definitions
return Field::defineValueForIntegration($value, $integrationField, $integration, $element, $fieldKey);
}
Not sure what the other consequences of doing this might be, but it does make the field mapping to subfields of Formie's address and name fields work correctly.
Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.8"
.
Fixed in 3.0.0-beta.9
Describe the bug
I have created a custom CRM integration which has field mapping set up in the form settings to map fields from the form to the CRM fields. This includes targeting subfields in the Formie name and address field types like this:
When the integration is applied, I am using the following code to map the submission fields to the CRM fields:
Example submission values look like this (from the form submission):
Name: First Name: Steve Last Name: Rowling
I would expect that, given the field mapping above, the CRM fields should look like this:
Instead, they look like this:
So instead of mapping the nested subfields to the CRM fields, the parent form field value has been applied to each of the CRM values.
This is happening for both native Formie name and address fields when I try to map subfields to CRM fields.
Steps to reproduce
TYPE_STRING
).Form settings
Craft CMS version
Craft Pro 5.0.5
Plugin version
3.0.0-beta.8
Multi-site?
No
Additional context
No response