Источник:
https://dynamicsaxinsight.com/2024/0...sist-to-table/
==============
Purpose:
Demonstrate how can we persist a custom field added to the New released product dialog form to the table in X++.
Application:
Dynamics 365 for Finance and Operations
Business requirement:
Business requirement is to add a new field to the New released product dialog form.
Solution:
We’re extending the EcoResProductCreate form and using chain-of-command extending the createData2Controls() method to add the new fields to the data2Controls container.
Also, in the second method, we’re making newly added field groups visible if this is a released product record.
Code
[ExtensionOf(formStr(EcoResProductCreate))]final class ATLAS_EcoResProductCreate_Form_Extension{ protected void createData2Controls() { next createData2Controls(); data2Controls = conIns(data2Controls, conLen(data2Controls) + 1, [tableStr(EcoResProduct), [[fieldNum(EcoResProduct, ATLAS_Manufacturer), formControlStr(EcoResProductCreate, ATLAS_Manufacturer)]]]); data2Controls = conIns(data2Controls, conLen(data2Controls) + 1, [tableStr(InventTable), [[fieldNum(InventTable, ATLAS_ManufacturerPartNum), formControlStr(EcoResProductCreate, ATLAS_ManufacturerPartNum)]]]); data2Controls = conIns(data2Controls, conLen(data2Controls) + 1, [tableStr(InventTable), [[fieldNum(InventTable, ATLAS_CatalogueType), formControlStr(EcoResProductCreate, ATLAS_CatalogueType)]]]); } public void setMoreFieldsVisible() { next setMoreFieldsVisible(); if (this.productData().identification().isReleasedProduct()) { ATLAS_ManufacturerGroup.visible(true); ATLAS_CancerCareGroup.visible(true); this.updateLayout(); } }}
Источник:
https://dynamicsaxinsight.com/2024/0...sist-to-table/