lunedì 16 marzo 2020

D365 FFO - lookup su formcontrol unbound

Questo link mostra come fare la lookup via CoC sul campo di un datasource:

https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/357208/lookup-on-form-datasource-field

Per fare la lookup su un controllo unbound dobbiamo fare così:

 [ExtensionOf(formControlStr(ProjTableWizard,FormControl))]  
 final class LILProjTableWizard_Extension  
 {  
   public void lookup()  
   {  
     next lookup();
  
     Query query = new Query();  

     query.addDataSource(tableNum(CustGroup));  
     
     SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(CustGroup),this);  
     systableLookup.addLookupfield(fieldNum(CustGroup, CustGroup), true);  
     systableLookup.addLookupfield(fieldNum(CustGroup, Name), false);  
     
     sysTableLookup.parmQuery(query);  
     sysTableLookup.performFormLookup();  
   }  
 }  

In questo modo invece possiamo effettuare la CoC sul metodo clicked di un pulsante:

 [ExtensionOf(formControlStr(WHSShipPlanningListPage,Transfer))]  
 final class MCSWHSShipPlanningListPageTransfer_Extension  
 {  
   void clicked()  
   {  
     FormDataSource      WHSShipmentTableDS;  
     FormControl      control = this as FormControl;  
     WHSShipmentTableDS = control.formRun().dataSource(formDataSourceStr(WHSShipPlanningListPage,WHSShipmentTable)) as FormDataSource;  
     next clicked();  
     WHSShipmentTableDS.research(true);  
   }  
 }  

Nessun commento:

Posta un commento