Skip to main content



No record found.

Customer Insights - Journeys forum
Suggested answer

Access Marketing Segment Query Language

Posted on by 75

Hey Guys,

we are currently facing an topic with the segmentation in D365 Marketing.

Here ist the case: We have contacts with a 1:n related entity (e.g. Subscriptions or Subscriptionservices), we can select the Subscriptionservices related with the contacts based on specific criteria. For Example

"Give me every contact with a unsubscribed Subscription with Cancellation reason = XXX", so we get a Subset of our contacts, later in the customer journey we only want to write to the contacts for the specific (and previously segmented) subscription service. But the customer journey doesn't know by which criteria we have segmented before and just takes all contacts from the segment and writes him to each of his subscription services (A Contact can have more than one Subscriptionservice, but not all of them are relevant for the current marketing campaign).

Question: Is there any way to solve this issue, my first idea is that I will create a Parser for the Query Language used in the segments and store this sepratly, but maybe someone has a better idea or tools?

Best regards Sven

  • Suggested answer
    Nya Profile Picture
    Nya 29,050 on at
    RE: Access Marketing Segment Query Language


    Your description is a little difficult to understand.

    Do you mean that you want to send an email to these Contacts via Customer Journey and that the content of the email contains the Subscription as a filter in Segment?


    For example, Contact has a 1: N relationship with Account as the Primary Contact of Account.

    I created a Segment to find out the Primary Contacts of the Accounts whose name equals a certain value.

    Then I created an email and inserted a Code block into it.


    Here is the code:



      {{#each contact.account_contact_primarycontactid}} {{#if (eq 'Acc 01')}}
    • {{}}
    • {{/if}} {{/each}}

    Then I got the account from the segment whose primary contact is the receiver of the email.


    You can set the subscriptions in the same way.


    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,


Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans