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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.03.2018, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,640 / 848 (80) +++++++
Регистрация: 28.10.2006
sertandev: Generating deep links for D365 FO forms and records
Источник: http://devblog.sertanyaman.com/2018/...s-and-records/
==============

Dynamics 365 FO has an API to create URL links that point to certain forms and records, in other words “Deep links”. This way you can share a record or query within AX with others for example within an e-mail, or inside an extensible control you have written.

Below I give an example method, used in a runnable job, which generates a deep link for a record on a form, using a single field as a query parameter. To be able to test it, cop and paste the code into a runnable class and run it in USMF company of D365 one-box development environment:



using Microsoft.Dynamics.AX.Framework.Utilities;class DeepLinkTestJob{private static str buildAXURL(MenuItemName _menuItemName, MenuItemType _menuItemtype, DataSourceName _dataSource='', FieldName _field='', str _value='' ){UrlHelper.UrlGenerator generator = new UrlHelper.UrlGenerator();System.Uri currentHost = new System.Uri(UrlUtility::getUrl());generator.HostUrl = currentHost.GetLeftPart(System.UriPartial::Authority);generator.Company = curExt();generator.MenuItemName = _menuItemName;generator.MenuItemType = _menuItemtype;generator.Partition = getCurrentPartition();generator.EncryptRequestQuery = true;if(_dataSource != ''){UrlHelper.RequestQueryParameterCollection requestQueryParameterCollection;requestQueryParameterCollection = generator.RequestQueryParameterCollection;requestQueryParameterCollection.UpdateOrAddEntry(_dataSource, _field, _value);}System.Uri fullURI = generator.GenerateFullUrl();return fullURI.AbsoluteUri;}public static void main(Args _args){str link;link = DeepLinkTestJob::buildAXURL(menuItemDisplayStr(CustTable), MenuItemType::Display, formDataSourceStr(CustTable,CustTable), fieldstr(CustTable, AccountNum), "US-002" );info(link);}}If you later copy and paste the resulting link, you will be able to open the same record on a different browser window.

The API passes the form filter as an encrypted JSON query data in the query string and opens the form with that record only. You can see this JSON data if you set the generator.EncryptRequestQuery to false and URL decode the resulting URL. As far as Microsoft support told me, the encryption is mandatory for data security reasons and you cannot just remove it to make query string shorter, it will fall into an error and not open.

https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF&prt=initial&mi=display:CustTable&q={"Parameters":[{"DataSource":"CustTable","FieldValues":[{"Field":"AccountNum","Value":"US-002"}]}]}In my tests in update 11, deep links did not work with some forms, for example it failed with all upgraded List page type of forms from AX 2012. If you encounter problems with failing deep links, try setting this parameter in your display menu item to ‘Yes’ and it will probably solve the problem :



For more information on deep links :

https://docs.microsoft.com/en-us/dyn...ate-deep-links









Источник: http://devblog.sertanyaman.com/2018/...s-and-records/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
deep link, dyn365fo

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
atinkerersnotebook: Embedding PowerView Dashboards within Dynamics AX Forms Blog bot DAX Blogs 0 29.09.2013 03:50
Microsoft Dynamics CRM Team Blog: Read-optimized forms Blog bot Dynamics CRM: Blogs 0 23.03.2012 04:25
axinthefield: Update multiple records with 'Fill Utility' Blog bot DAX Blogs 0 21.06.2011 19:11
emeadaxsupport: Forms with a high number of records take a significant time to show Blog bot DAX Blogs 4 12.09.2010 21:10
Axapta Lessons: Merge Customer Records Blog bot DAX Blogs 0 28.10.2006 18:22
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:22.