Skip to content

Commit 0165326

Browse files
author
Avikarsha Saha
committed
Merge branch 'MAUt-11460' into beta
2 parents 4c8f04d + a9b270f commit 0165326

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

EventListener/TokenSubscriber.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,12 @@ private function getCustomFieldValue(CustomObject $customObject, string $customF
452452
if (empty($fieldValue->getValue())) {
453453
$fieldValue->setValue($fieldValue->getCustomField()->getDefaultValue());
454454
}
455-
$fieldValues[] = $fieldValue->getValue();
455+
456+
if (in_array($fieldValue->getCustomField()->getType(), ['multiselect', 'select'])) {
457+
$fieldValues[] = $fieldValue->getValue();
458+
} else {
459+
$fieldValues[] = $fieldValue->getCustomField()->getTypeObject()->valueToString($fieldValue);
460+
}
456461
} catch (NotFoundException $e) {
457462
// Custom field not found.
458463
}
@@ -528,6 +533,7 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
528533
}
529534

530535
$leadValues = $lead[$data['field']];
536+
$leadValues = 'custom_object' === $data['object'] ? $leadValues : [$leadValues];
531537
$filterVal = $data['filter'];
532538
$subgroup = null;
533539

Tests/Functional/Token/EmailWithCustomObjectDynamicContentFunctionalTest.php

+23-11
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,29 @@ private function buildDynamicContentArray(array $inputs): array
188188
'filters' => [
189189
[
190190
'content' => 'Custom Object Dynamic Content',
191-
'filters' => array_map(function ($input) {
192-
return [
193-
'glue' => 'and',
194-
'field' => 'cmf_'.$this->customFieldValues[$input[0]]->getCustomField()->getId(),
195-
'object' => 'custom_object',
196-
'type' => $input[3] ?? 'text',
197-
'filter' => $input[1],
198-
'display' => $this->customObject->getName().':'.$this->customFieldValues[$input[0]]->getCustomField()->getLabel(),
199-
'operator' => $input[2],
200-
];
201-
}, $inputs),
191+
'filters' => array_merge(
192+
array_map(function ($input) {
193+
return [
194+
'glue' => 'and',
195+
'field' => 'cmf_'.$this->customFieldValues[$input[0]]->getCustomField()->getId(),
196+
'object' => 'custom_object',
197+
'type' => $input[3] ?? 'text',
198+
'filter' => $input[1],
199+
'display' => $this->customObject->getName().':'.$this->customFieldValues[$input[0]]->getCustomField()->getLabel(),
200+
'operator' => $input[2],
201+
];
202+
}, $inputs),
203+
[
204+
[
205+
'glue' => 'and',
206+
'field' => 'email',
207+
'object' => 'lead',
208+
'type' => 'email',
209+
'filter' => null,
210+
'operator' => '!empty',
211+
],
212+
]
213+
),
202214
],
203215
],
204216
],

0 commit comments

Comments
 (0)