AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
CRM
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.12.2018, 04:22   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
gustafwesterlund: Formating Web API query for getting VoC Survey questions
Источник: http://gustafwesterlund.blogspot.com...tting-voc.html
==============

Working with a Flow to do some text analysis and sentiment analysis on Voice of the customer responses.

The trick, as the payment model is per run, is to trigger it per Survey Response, and not Question Response. Hence the logic has to loop through all the question responses.

The way you create a filter in Flow for the query is to use Odata filters. However, I found that these were a casing nightmare, which those of you who have worked with more, probably also have noticed.

After troubleshooting a lot with different queries in the browser I finally found that the following actually worked. Note that you will have t change the guid to your own.

https://dev-dtn.api.crm4.dynamics.com/api/data/v9.1/msdyn_questionresponses?$select=msdyn_name,msdyn_SurveyResponseId&$filter=msdyn_SurveyResponseId/msdyn_surveyresponseid%20eq%20460279E7-2AF2-E811-A97F-000D3AB0C08C

The tricky part, as you can see, is that the first part of the lookup attribute, is defined in camel-case and the one in the related entity (Survey Response) in lower case.

The part you need in the Flow is the last part, but it is useful to test it directly in the browser to make sure you get the syntax correct.
Its the filter part of the query that you are to enter into the "Filter query" field, and make sure to make it dynamic. :)
And this is how it looks in Dynamics 365 CE if you check out the fields. I like to look at them in the list view as I can see the schema name there, which isn't visible in the Form.

msdyn_SurveyResponseId Lookup from the Question Response Entity. As you can see it seems to be using the Schema name above.
This is the primary field Survey Response. Do note the subtle difference between the fields, that Id is spellt with a capital "I" in the Schema name. Based on the information above, it hence seems to be using "Name" to indicate the field.
Hence based on the above, the supposition would be that the syntax is /


I then did a query to business Unit and I was very surprised to find that it was rather inconsistent and looked like this:

https://dev-dtn.api.crm4.dynamics.com/api/data/v9.1/businessunits?$select=cntso_organizationbaseurl&$filter=parentbusinessunitid/businessunitid%20eq%20null

with just the query that would be

parentbusinessunitid/businessunitid eq null

Let's have a look at the fields in Dynamics:


The Parent Business Unit Lookup in Business Unit (Self Referential). Note that the Schema name is Pascal Case.
key field, businessunitid in Business Unit

And as you can see, if we were to follow the syntax set by the example above, this should be:

ParentBusinessUnitId/businessunitid

However, that didn't seem to work, and as a pragmatist, I have to conclude, somewhat sad, that this doesn't seem to be very consistent.

My recommendation is hence when working with this:
  • Do not take any casing for granted
  • / is probably correct for most custom fields/entities.
  • Many older entities and fields, like the businessunit shown above, has been there since CRM 1.0 or at least 3.0, if I remember correctly and hence the syntax might be different.
  • Test your queries directly in the browser like I have shown above.
Good luck with your Flows.

And if you know Swedish, make sure you check out my colleague Martin Burmans article on Flow as well. Not sure how well it turns out in translation. https://www.crmkonsulterna.se/flow-i-medvind/

Gustaf Westerlund
MVP, Founder and Principal Consultant at CRM-konsulterna AB
www.crmkonsulterna.se

Источник: http://gustafwesterlund.blogspot.com...tting-voc.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dynamicsnavax: Hybrid connection - Web Api App for AX 2012 to Azure-part 4 Blog bot DAX Blogs 0 14.09.2017 13:11
Microsoft Dynamics CRM Team Blog: Onboarding to Web API for Dynamics CRM 2016 from Web API Preview Blog bot Dynamics CRM: Blogs 0 17.02.2016 05:25
crminthefield: Dynamics CRM 2011 SDK Query Limitations by API Blog bot Dynamics CRM: Blogs 0 14.01.2013 20:11
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0: Understanding Connections Blog bot Dynamics CRM: Blogs 0 20.01.2009 02:07
Inside Dynamics AX 4.0: The Web Framework Blog bot DAX Blogs 0 25.10.2007 03:04
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:28.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.