Tuesday 15 August 2023
Form Event Handler in D365fo
///
/// Event Hnadler Class For Ledger Journal Table Form
///
final class SCA_FS_LedgerJournalTableFormEventHandler
{
///
/// Approve Event For Approve
///
/// sender of event
/// Event Args
///
[FormControlEventHandler(formControlStr(LedgerJournalTable, Approve), FormControlEventType::Clicked)]
public static void Approve_OnClicked(FormControl sender, FormControlEventArgs e)
{
LedgerJournalTable journal = sender.formRun().dataSource('LedgerJournalTable').cursor();
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingStatusTable workflowTrackingStatusTable;
select firstonly RecId from workflowTrackingStatusTable
order by workflowTrackingStatusTable.CreatedDateTime desc
where workflowTrackingStatusTable.ContextRecId == journal.RecId
join User from workflowTrackingTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Submission;
journal.ReportedAsReadyBy = workflowTrackingTable.User;
}
///
/// Reject Event For Reject
///
/// sender of event
/// Event Args
///
[FormControlEventHandler(formControlStr(LedgerJournalTable, Reject), FormControlEventType::Clicked)]
public static void Reject_OnClicked(FormControl sender, FormControlEventArgs e)
{
LedgerJournalTable journal = sender.formRun().dataSource('LedgerJournalTable').cursor();
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingStatusTable workflowTrackingStatusTable;
select firstonly RecId from workflowTrackingStatusTable
order by workflowTrackingStatusTable.CreatedDateTime desc
where workflowTrackingStatusTable.ContextRecId == journal.RecId
join User from workflowTrackingTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Submission;
journal.ReportedAsReadyBy = workflowTrackingTable.User;
}
}
Labels:
Code,
D365fo,
event handler
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment