Requirement:
The requirement was to display information of selected records of form Grid on a string control.The information on custom string control should change during the marking of records in real time.
Sample Code:
Copy the method in form datasource.
- public void markChanged()
- {
- AcxBrandMaster acxBrandMaster1;
- str brandStr;
- MultiSelectionHelper multiSelectionHelper = MultiSelectionHelper::construct();
- multiSelectionHelper.parmDatasource(AcxBrandMaster_DS);
- acxBrandMaster1 = multiSelectionHelper.getFirst();
- FormStringControl1.text(“”);
- while (acxBrandMaster1.RecId)
- {
- brandStr = brandStr + acxBrandMaster1.Brand;
- acxBrandMaster1 = multiSelectionHelper.getNext();
- }
- FormStringControl1.text(brandStr) ;
- super();
- }
Like this:
Like Loading...
Requirement
Vendor Address Lookup in purchase order creation form (PurchCreateOrder).
Sample Code
For simple form control, we can use SysTableLookUp class & write code in onlookup event of form control.The sample code is mentioned in below line:
D365/AX7: Extend Form Control OnLookup Event On Standard Form
But for reference group control in form, SysTableLookup doesnot work.There is one different class called SysReferenceTableLookup For Reference Group In Form.Also in D365 there is no event related LookUpReference method.So i am using OnLookup event.
class AcxPurchCreateOrderFormEvents
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(PurchCreateOrder, PurchTable_AcxDeliveryPostalAddressVend), FormControlEventType::Lookup)]
public static void PurchTable_AcxDeliveryPostalAddressVend_OnLookup(FormControl sender, FormControlEventArgs e)
{
VendTable vendTable;
Common common;
PurchTable purchTable = sender.formRun().dataSource(formDataSourceStr(PurchCreateOrder,PurchTable )).cursor();
VendTable = VendTable::find(purchTable.OrderAccount);
SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup ::newParameters(tableNum(LogisticsPostalAddress),sender);
Query q = new Query();
QueryBuildDataSource qbds;
qbds = q.addDataSource(tableNum(LogisticsPostalAddress));
sysTableLookup.addLookupfield(fieldNum(LogisticsPostalAddress, Location));
sysTableLookup.addLookupfield(fieldNum(LogisticsPostalAddress, Address));
sysTableLookup.parmQuery(q);
sysTableLookup.performFormLookup();
FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
ce.CancelSuperCall();
}
}
Like this:
Like Loading...
Microsoft Dynamics AX, Microsoft Dynamics 365 for Finance and Operations, D365 FO, Retail, SQL, Microsoft Power Apps, Microsoft Power BI, Microsoft Azure, Logic Apps, Microsoft Flow, Microsoft power automate, Microsoft Power Platform,.Net, X++, C#, Power BI DAX, Data Warehousing, Microsoft Analysis Services, SQL Server Reporting Services