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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 24.04.2019, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1256: Get attribute of the first record from the list
Источник: https://crmtipoftheday.com/1256/get-...from-the-list/
==============
This is probably a super simple question, but I’m a super simple flow user. After listing records from D365 how would I go about retrieving an attribute value of the first result returned?

Michael “Super Simple Flow User” Ochs
I won’t name the person who suggested the following:
  1. Declare variables to store values.
  2. Include top 1 limit for your query.
  3. Loop through your set (so 0 or 1 record) and set required values to variables.
  4. Use it and enjoy.
You know who you are, Andrii “Granny’s Moonshine” Butenko, and credit is where credit due – step 2 is actually correct if you only need that one record. I guess step 4 is also correct when you get something right.

The way I would do it:
  1. Build the query using filter, orderby and top to get exactly what I am after.
  2. Use expression to get the attribute while avoiding the runtime errors.
Demo

Let’s say I have an account and I want to find the full name of child contact created last.

Build the query by filtering contacts on the parent account, ordering the results by createdon in descending order (so that the last created contact is on top), then limiting results to 1.


After that, use the following expression to get the full name of the first contact returned.

body('Get_Last_Contact')?['value']?[0]?.fullnameNote that the query may or may not return any results so we use question mark operator (?) to avoid runtime errors.
To reference null properties in an object without a runtime error, use the question mark operator.

Workflow Definition Language schema
The result is either the full name or empty (if account has no contacts).

The only downside of using the expression (besides being not-exactly-nocode) is that the expression won’t know when you rename the List Records step. Which is why Tip #1247 is important.




Источник: https://crmtipoftheday.com/1256/get-...from-the-list/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crmtipoftheday: Tip #1249: Talk back from canvas to model-driven Blog bot Dynamics CRM: Blogs 0 10.04.2019 05:19
crmtipoftheday: Tip #1238: Painless upgrade from 8 to 9 Blog bot Dynamics CRM: Blogs 0 21.03.2019 18:11
Need to get previous but one record from PO in ax 2009 pawan DAX in English 8 06.12.2012 03:13
Gareth Tucker: Duplicate Record Button using Jscript in Microsoft CRM 2011 Blog bot Dynamics CRM: Blogs 0 31.07.2012 16:11
Afna CRM: Get a list of searchable attributes from database Blog bot Dynamics CRM: Blogs 1 29.08.2009 11:46
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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