Hi All,
I'm using advanced find to retrieve the dynamic and static segment member and there is result return. Then I try to download the fetchxml file from the advanced find and put in my csharp code. However seem there is no result return.
Then I copied the fetchxml file into FetchXmlTester in Xrmtoolbox, it also didn't return any result. FYI, my segment have 1 contact in the advanced find result. Below is my fetchxml
Anything I missed out?
Thanks.
Regards,
Teh
No worried. It is working now. Flow looks like this . I had to get segment query name and use compose .
Hi
I tried to call the action in Power Automate but I am facing invalid query syntax issue.
[{"__type":"SegmentationCrmApiResponseError:#Microsoft.Dynamics.Crm.MarketingPlugins.Plugins.Segmentation.Contracts","ErrorCode":"QuerySyntaxError","Message":"Invalid query language: \u000aLine: 0, Position: 32, Column: 32: Number cannot be followed by a letter."}]
Power Automate looks like below.
Hi Teh,
In general fetchXml query, we could break the limitation with "paging cookie".
However, currently we are calling an action, and fetchxml here is only a parameter,
in other word, we are not running a general fetchxml query, so I'm not sure whether there is way to handle current situation.
I suggest you could open a support ticket to ask whether the maximum number could be upgraded at back-end for "msdyncrm_FetchContactsByQuery" if you have requirement about large number query.
Regards,
Clofly
Hi Clofly,
Thanks for your prompt reply. What if we have more than 5000 of segment member? How to retrieve all member in the segment?
Thanks.
Regards,
Teh
Hi Teh,
The maximum number is 5000.
Regards,
Clofly
Hi Clofly,
Thanks for your reply. Using your sample code, I managed to get the segment member now.
I noticed that in your query, you are limit to 1st 15 contacts, correct? Is there any limit of the max contact that can return from the query?
Thanks.
Regards,
Teh
Hi Teh,
From metadata definition, calling "msdyncrm_FetchContactsByQuery" in Plugin or Workflow could be regarded as calling an action by organizationService.
String fetchxml = "" "" "" "" "" "" "" "" "" ""; OrganizationRequest orgRequest = new OrganizationRequest("msdyncrm_FetchContactsByQuery"); orgRequest.Parameters.Add("Query", "(SEGMENT(SEGMENT_CRM_ID_237349c9428fea11a811000d3a80c3f7)).ORDERBY(fullname ASC).SKIP(0).TAKE(15).SELECT(contactid)"); orgRequest.Parameters.Add("FetchXml", fetchxml); orgRequest.Parameters.Add("Scope", 270100000); orgRequest.Parameters.Add("TimeZone", null); OrganizationResponse orgResponse = organizationService.Execute(orgRequest);
Regards,
Clofly
I just realized that seem the FetchXml way to retrieve the records is deprecated.
POST {{OrgUrl}}/api/data/v9.0/msdyncrm_FetchContactsByQuery { "Query":"(SEGMENT(SEGMENT_CRM_ID_e1fa7fdc5c78ea11a811000d3a8e8fcc)).ORDERBY(fullname ASC).SKIP(0).TAKE(15).SELECT(contactid)", "FetchXml":"","OwningBusinessUnit":"0b4b85cc-7f6c-ea11-a811-000d3a54d359", "Scope":270100000, "TimeZone":null }
I saw there is a recommended way to retrieve it. However, I'm not sure how to convert this code in Plugin or custom workflow?
I'm try to run the {orgurl}/api/data/v9.0/msdyncrm_FetchContactsByQuery to retrieve the metadata, but I cant find msdyncrm_FetchContactsByQuery in the list.
Does anyone know how can I convert the code above to use in the Plugin or Custom workflow?
Thanks.
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Muhammad Shahzad Sh...
106
Most Valuable Professional
Eugen Podkorytov
102