hljs.configure({cssSelector: "code"}); hljs.highlightAll();

Tuesday, June 6, 2023

Opening Journal lines From a custom form in D365FO using X++

 Opening Journal lines From a custom form in D365FO using X++

//Clicked method of custom form control
Public void clicked()
{
   FormDataSource          FormDataSource; 
   Dax_LedgerJournalTable  daxLedgerJournalTable; 
   LedgerJournalTable      LedgerJournalTablenew; 
   
   super(); 

   FormRun formrunrecord,formRun; 
   formrunrecord = this.formRun() ; 
   FormDataSource = formrunrecord.dataSource("Dax_LedgerJournalTable"); 
   daxLedgerJournalTable = FormDataSource.cursor() ; 
   LedgerJournalTablenew = LedgerJournalTable::find(daxLedgerJournalTable.JournalNum); 
   Args args; 
   
  // object formRun; 
   JournalFormTable journalForm; 
   
   //Open form 
   args = new Args(); 
   args.name(formStr(LedgerJournalTable)); 
   LedgerJournalTable = LedgerJournalTable::find(daxLedgerJournalTable.JournalNum); 
   args.record(LedgerJournalTable);  
   formRun = classfactory.formRunClass(args); 
   formRun.init(); 
   formRun.run(); 

   args.caller(formRun); 
   journalForm = JournalForm::fromArgs(args); 
   if (journalForm && journalForm.journalTableData().journalTable().JournalId ==LedgerJournalTable.JournalNum) 
   {		
	 journalForm.openLinesForm(); 
   }
   formRun.close(); 
 }

We can achieve this using in below way as well. To check out Click here

Keep learning!!

No comments:

Post a Comment