Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAUT-12306: Use the same value query when dealing with merged filters #364

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

dongilbert
Copy link
Member

Q A
Bug fix? (use the a.b branch) [ ]
New feature/enhancement? (use the a.x branch) [ ]
Deprecations? [ ]
BC breaks? (use the c.x branch) [ ]
Automated tests included? [ ]
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

We discovered an issue when replacing custom-object tokens within an email when that email was based on segments containing custom object filters. If the custom_object_merge_filter parameter is set to true and the custom_object_item_value_to_contact_relation_limit is set to 0, the most recently created custom object (of the specified type) is used when replacing the token.

The scenario is this:

  • Create a custom object "Kids" with a Text field - Name, Numeric field - Age
  • Create 3-4 custom items from the above CO
  • Link a contact with all these custom items
  • Create a segment with filter on CO: Age Equals 6 (assuming you have an item with age = 6)
  • Create a segment email, utilize the segment created in step 4
  • In the email builder merge-tag, find and select the token for CO: Name ( a long token will get inserted in the builder - Do not modify anything in that)
  • Save & Close the Email
  • Go to Preview the email → Search the contact that you’ve linked the custom items with.
  • Observe the output rendered. This output is not accurate and results in incorrect information being rendered.
  • The output rendered will show the latest custom item attached to the contact rather than the custom item which matches the filter.

This PR ensures segment filters utilizing custom objects will behave similarly, regardless of whether the custom_object_merge_filter option is on or off (except for mandatory differences covered in other parts of the code untouched by this PR)

Steps to test this PR:

  1. Open this PR for testing locally (see docs on testing PRs here)
  2. Perform the steps outlined above and see that the correct custom item is used to render the output.

@pagupt pagupt requested review from rohitp19 and escopecz February 27, 2025 05:08
@rohitp19 rohitp19 requested review from dadarya0 and removed request for rohitp19 February 27, 2025 09:49
Copy link
Contributor

@dadarya0 dadarya0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes looks good to me 👍

Copy link
Contributor

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with https://john.dev.acs.acquia.io/email/download/preview/9?contactId=2. If no contact is selected or a contact that isn't part of the source segment then I see 7yo. For the contact in the source segment I can see 6yo which is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants