Показать сообщение отдельно
Старый 16.12.2019, 07:30   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
alirazazaidi: How to get calling menu name in extensions Dynamics 365 for finance and operations
Источник: https://www.tech.alirazazaidi.com/ho...nd-operations/
==============

Today is small tip,Many times, we have to took decision based on the name of menu on which form is called. By getting menu namewe can use same form for different purposes. We can write logic based on current form called from which menu item.

Following is thecode snippet helps you to achieve this.

[FormEventHandler(formStr(LogisticsContactInfoGrid), FormEventType::Initialized)]    public static void LogisticsContactInfoGrid_OnInitialized(xFormRun sender, FormEventArgs e)    {        FormRun formRun = sender;                if (formRun.args().menuItemName() == "CustomerLogisticsContactInfoGrid")        {            FormDataSource      LogisticsElectronicAddress_ds =formRun.dataSource("LogisticsElectronicAddress");            LogisticsElectronicAddress_ds.InsertIfEmpty(true);            LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, Locator)).mandatory(true);        }

Источник: https://www.tech.alirazazaidi.com/ho...nd-operations/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.