Показать сообщение отдельно
Старый 17.01.2024, 07:32   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: D365: How to get caller form name in Form extension class
Источник: https://dynamicsaxinsight.wordpress....tension-class/
==============

Purpose:

Demonstrate how to get caller form name in a Form extension class in X++.

Application:

Dynamics 365 for Finance and Operations

Solution:

The code below gives a very good example of how can get the caller form name in a Form extension class in X++ which then can be used to run the business logic.

In the code below, we’re adding a display method for a control on the form RetailAddItems to display Site. We’re getting Site from a form data source on the caller form. In this case, caller form is PurchTable and caller form data source is also PurchTable.

Code

[ExtensionOf(formStr(RetailAddItems))]internal final class MAK_RetailAddItems_Extension{ display InventSiteId displayPurchSiteId() { InventSiteId siteId; FormRun callerFormRun; callerFormRun = this.args().caller(); if (callerFormRun.name() == formStr(PurchTable)) { FormDataSource purchTable_ds = callerFormRun.dataSource(formDataSourceStr(PurchTable, PurchTable)) as FormDataSource; PurchTable purchTable = purchTable_ds.cursor() as PurchTable; if (purchTable) { siteId = purchTable.InventSiteId; } } return siteId; }}


Источник: https://dynamicsaxinsight.wordpress....tension-class/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.