Posts

Showing posts with the label EventHandler

Modified Event Handler In D365 AX X++ Fianance & Operations

[DataEventHandler(tableStr(InventJournalTable), DataEventType::ModifiedField)] public static void InventJournalTable_onModifiedField(Common sender, DataEventArgs e)     {         InventJournalTable                  inventJournalTable = sender;         ModifyFieldEventArgs           args = e as ModifyFieldEventArgs;         FieldId                                     fieldId = args.parmFieldId();                   switch(fieldId)             {                 case fieldNum(InventJournalTable, InventSiteId) :                     //Logic         ...

Form data source activation code D365 AX X++

  [FormDataSourceEventHandler(formDataSourceStr(BOMConsistOf, BOMVersion), FormDataSourceEventType::Activated)]     public static void BOMVersion_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)     {         BOMVersion                      bOMVersion;         FormDataSource                  fds;         FormRun                         formRun;         bOMVersion                      = se...

On clicked event of form button in D365 X++

Form : SalesQuotationListPage Button : DH_AmendmentButton DataSource : SalesQuotationTable [FormControlEventHandler(formControlStr(SalesQuotationListPage, DH_AmendmentButton), FormControlEventType::Clicked)]     public static void DH_AmendmentButton_OnClicked(FormControl sender, FormControlEventArgs e)     {         FormRun                  fromRunLoc;         FormDataSource      formDataSourceLoc;         SalesQuotationTable salesQuoteTable;         DH_SalesQuote        DHQuote;         fromRunLoc             = sender.formRun();         formDataSourceLoc   = sender.formRun().dataSource("SalesQuotationTable");         salesQuoteTable       = formDataSourceLoc.cursor(); ...

On inserted event of table D365 x++

[DataEventHandler(tableStr(SalesQuotationTable), DataEventType::Inserted)]     public static void SalesQuotationTable_onInserted(Common sender, DataEventArgs e)     {         SalesQuotationTable         salesQuotationTable = sender;         DH_SalesQuote              SalesQuote;         select firstonly SalesQuote             where SalesQuote.QuotationId == salesQuotationTable.QuotationId;         if (!SalesQuote.RecId)         {             SalesQuote.QuotationId  = salesQuotationTable.QuotationId;             SalesQuote.RefRecId     = salesQuotationTable.RecId;             SalesQuote.DocumentWorkflowState    = DH_DocumentWorkflowState::NotSubmitte...