We have a requirement where we need to list all Preference Lists that the contact receiving the email has been subscribed to, so we can dynamically show or hide different content blocks related to those preferences within the email.
As suggested here https://docs.microsoft.com/en-us/dynamics365/marketing/dynamic-email-content and here https://community.dynamics.com/365/marketing/b/dynamics-365-for-marketing-community-blogs/posts/add-dynamic-content-to-marketing-emails-and-show-event-sessions, the only way to do that is to insert a Code Block element in the marketing email and provide with these code lines:
{{#each contact.listmember_list_contact}} {{#if (eq this.listid '" blockListId "')}}" contentBlockHTML "{{/if}} {{/each}}
However this is not working at all. Even if we simplified to this:
Nothing appears, only blank space.
What are we doing wrong?
Best regards
Hi Roy - unfortunately nothing at this point. My team is beginning to look into this further so hopefully an update/solution is on the way.
J
Hello James DC - Marketing ,
I am currently exploring dynamics email content in the similar lines as you mentioned. Where you able to figure out a solution?
I'd appreciate your response.
Hi there,
So I am trying to solve this exact issue currently; building an email that displays content blocks based off subscription/marketing lists.
For example, say a contact is in subscription lists 'Cars' and 'Boats', but not 'Bikes' - I'd like to display the content block for 'Cars' and the contact block for 'Boats'.
What I have so far is using:
{{#if (eq contact.listmember_list_contact Cars)}}
...not sure how to link in the contact block for Cars...
{{else if (eq contact.listmember_list_contact Boats)}}
...not sure how to link in the contact block for Boats...
{{else}}
...fallback content block
{{/if}}
Any help on this would be amazing.
Thanks in advance!
Thanks for answer
We are using the N:N relationship between Contact and Marketing List:
Hi, Manuel
Does the Preference Lists you mentioned refer to the Marketing Lists?
If so, it’s an N: N relationship between Marketing List and Contact while the example you referred to is an N: 1.
Unfortunately, N: N relationship has not been supported in Code Block.
For this type of relationship is not linked by the specified field, it is not possible to find the corresponding list by emailing the identified contact.
You can find the description about N: N relationship in the documentation you mentioned:
Add dynamic content to marketing emails (Dynamics 365 Marketing) | Microsoft Docs
And here is a related issue:
many to many relation - Dynamics 365 Marketing Forum Community Forum
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Nya
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156