web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

#each Repeating dynamic content when more than one child record meets criteria

(1) ShareShare
ReportReport
Posted on by 422
Hi all,
So I want to show/hide a block of content in an email based on one or more child records of a contact having a certain value. This example is using leads. What I'm finding is that if I have two leads with the same value which meet the criteria, then it will repeat the section two times.
Has anyone else hit this?
I've code elements with my #each and #if statements and "some text" in-between, if the subject of the lead is "hi" then show the section (everything up until the 2nd code element where the /each and /if statements are):

Lead-Dynamic-Content-1.PNG

Lead-Dynamic-Content-2b.PNG

Lead-Dynamic-Content-3.PNG

Aside from rolling attributes up to the Contact record, is there a way to only show one section implementing the "show single block if one or more child record = x" type logic here?

Thanks

Alex

I have the same question (0)
  • slx Profile Picture
    386 on at
    RE: #each Repeating dynamic content when more than one child record meets criteria

    Do you know if I can compare two values in the [tag:each] iteration ?

    Let's say the results has 4 counts, could I copy the values in a JS array and do the search array[0] and array[1] value ?

  • AlexJay Profile Picture
    422 on at
    RE: #each Repeating dynamic content when more than one child record meets criteria

    Ok Nya, thank you for confirming this is just how it works for now and I’m not missing anything, this is helpful, I will post on the ideas forum. Cheers.

  • Verified answer
    Nya Profile Picture
    29,060 on at
    RE: #each Repeating dynamic content when more than one child record meets criteria

    Hi Alex,

    Yes, it will be repeated.

    But for the time being there is no solution to this problem, it is a limitation of the function itself.

    Maybe you could post a proposal in Ideas forum for further help.

  • AlexJay Profile Picture
    422 on at
    RE: #each Repeating dynamic content when more than one child record meets criteria

    Hi Nya

    Thank you for your reply.

    I am using the same syntax as you have posted. The issue is that the section/text is repeated if more than one child record meets the criteria.

    Perhaps if you have time you can confirm if you experience the same?

    Thanks

    Alex

  • Suggested answer
    Nya Profile Picture
    29,060 on at
    RE: #each Repeating dynamic content when more than one child record meets criteria

    Hi Alex,

    The code snippet should be something like:

    {{#each contact.lead_contact_parentcontactid}}
        {{#if (eq this.subject 'hi')}}
            Sometext
        {{/if}}
    {{/each}}

    The text which is needed to be shown should be contained in the code block.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 143

#2
DAnny3211 Profile Picture

DAnny3211 134

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans