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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 23.03.2017, 22:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
atinkerersnotebook: Using Functions within Flow using the Compose Action
Источник: https://atinkerersnotebook.com/2017/...ompose-action/
==============

Flow is great, and just being able to point and click to build integrations is the thing that makes it so usable. But sometimes you want to be a little bit cleverer with your data and even use functions that remodel the data.


For example, when creating a new Customer within Dynamics 365 for Operations through Flow when a new Account is created in the Common Data Service, if you are like me, then maybe you will want to have a consistent naming convention, and you don’t want to use the standard Account ID that is created in the entity.


My customer naming convention is the first two letters of the Organization Name and then 4 digits, but I cannot change the default numbering format for the Account Id in the Accounts entity.


If I were doing this through Excel, then I would use this formula: 


Upper(Left(OrganizationName)) & Right(AccountId,4)


But how do you do this in Flow?


The good news is that there is a special Data Operations service within Flow that allows you to create a function using data from the previous steps in the flow, and then you can use the output in subsequent steps.


Here is how you do it.


How to do it…


To start off open Flow and then create a new Flow by clicking on the + Create from blank link.


When the trigger event is displayed, search for the Common Data Service actions and select the When a record is created trigger event.


This will then create a trigger for you that needs to be configured.


Click on the The database dropdown list and select the default database.


Then click on the The entity dropdown list and select the Account entity from the list.


Now that we have the trigger which will fire when a new Account is created within the Common Data Service we want to add a step that will create our new account name from the data. To do this, click on the + New Step button and then select the Add an action button.


When the action browser is opened, search for the Data Operations service and then select the Compose action.


This will open a simple action that just has an Input field. This is where we need to create our function that will create our new Customer Number.


The function will be written in the Azure Workflow Definition Language and if you want to find all the documentation on it then here is the link:


https://docs.microsoft.com/en-us/azu...ition-language


To create the new customer number that is the first two letters of the Organization Name and the last 4 digits of the Account Id (since this is a sequential number) then just paste in this function:


“@concat(toUpper(substring(triggerBody()[‘OrganizationName’],1,2)),substring(triggerBody()[‘AccountId’], sub(length(triggerBody()[‘AccountId’]),4), 4))”


After you have done that just give the Flow a Flow name and then click on the Create flow button.


After the record has been published then you will see that the Account ID is created for the Account.


When you return to you Flow you will see that is has been triggered and if you expand out the Compose action then the Output is now set to the format that we want for our Customer Numbers.


Summary


Now that we have composed our new field we can now use it in future steps within the Flow. For example if you continue on and add another action that created the Customer within Dynamics 365 for Operations, but when populating the Customer Number field, we can now use the output of the Compose action.


How cool is that? (Rhetorical question)





Источник: https://atinkerersnotebook.com/2017/...ompose-action/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
atinkerersnotebook: Creating New Customer Notifications for Dynamics 365 for Operations using Flow and the Common Data Service Blog bot DAX Blogs 0 15.12.2016 22:12
atinkerersnotebook: Creating a Contact Registration App for Dynamics using PowerApps Blog bot DAX Blogs 0 25.08.2016 22:11
atinkerersnotebook: Using PowerPivot to Analyze Dynamics AX Data Blog bot DAX Blogs 1 05.10.2013 07:23
atinkerersnotebook: Using Service Management to Track Service Orders Blog bot DAX Blogs 1 25.08.2013 19:16
atinkerersnotebook: Configuring Lean Manufacturing in Dynamics AX 2012 Blog bot DAX Blogs 1 12.08.2013 00:15
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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