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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Use segment query condition in custom channel to query related entities

(0) ShareShare
ReportReport
Posted on by 2 Microsoft Employee
Hi,
 
I have created a segment and its query like below
 
PROFILE(contact, contact_1)
    .RELATE(account_contact_primarycontactid, account_1)
    .FILTER(contact_1.address1_stateorprovince == 'California' && account_1.address1_stateorprovince == 'Washington')
 
In my customer journey, I added a custom channel tile. When a custom channel activity record was created, it will trigger my plugin code. 
In plugin, I would like to use the conditions of the related entity in the segment query /account_1.address1_stateorprovince == 'Washington'/ to find those account records of contact. 
 
How can I achieve this?  My example is simple.  What if the query is getting complex and involve multiple related entities? 
Is there a way to retrieve the query as FetchXML or QueryExpression? 
 
Thanks.
 
ART
I have the same question (0)
  • Suggested answer
    RudyZhang Profile Picture
    Microsoft Employee on at
    Hi,
     
    Regarding your request to convert a segment query statement into a FetchXML or QueryExpression.
     
    According to our team's search this is not an OOTB feature, you need to use the FetchXML Builder and create the query manually. For more information about FetchXML Builder, please refer to the link below.
    https://fetchxmlbuilder.com/
     
    Our team's testing process is as follows
     
    Step1, we construct a segment query using the segment query statement you provided.

     
    Step2, based on the constructed segment query, use FetchXML Builder to construct the query.

    Step3, transform the FetchXML query statement into QueryExpression.

     
    In addition, the above steps are just a general step, the specific details of the query need to be designed according to your business.
     
     
    I hope my answer is helpful to you! If you have any other questions, please feel free to contact me.
     
    Best Regards,
    Rudy Zhang
  • CU27040941-12 Profile Picture
    2 Microsoft Employee on at
    Hi Rudy,
     
    Thanks for your suggestion.
    However, manually create the query expression would not meet our requirements.
    We basically need to find ways to figure out what account records did the segment query retrieved.
    Any other possible way we can look at?
     
    Thanks
     
    ART
  • RudyZhang Profile Picture
    Microsoft Employee on at
    Hi,
     
    We apologize that our team did not find another way to meet your needs.
     
    Since this is not an out-of-the-box feature, a third-party plugin may be required if it is to meet your needs.
     
    Additionally, if you think your need is an essential feature, I recommend you use the link below to propose your idea to the Dynamics 365 community.
    https://experience.dynamics.com/ideas/
     
    Best Regards,
    Rudy Zhang

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 140 Super User 2026 Season 1

#2
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans