Tuesday, 15 August 2023
Table Modified field using coc in D365fo
///
/// Extension of LedgerJournalTable
///
[ExtensionOf(tableStr(LedgerJournalTable))]
final class SCA_FS_LedgerJournalTable_Extension
{
///
/// Proccess the modified field events for LedgerJounal trans
///
/// reference to fieldId
public void modifiedField(FieldId _fieldId)
{
next modifiedField(_fieldId);
if (_fieldId == fieldNum(LedgerJournalTable, testfield) && this.JournalType == LedgerJournalType::Payment)
{
//if(this.WorkflowApprovalStatus == LedgerJournalWFApprovalStatus::Approved || this.WorkflowApprovalStatus == LedgerJournalWFApprovalStatus::Rejected)
{
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingStatusTable workflowTrackingStatusTable;
select firstonly RecId from workflowTrackingStatusTable
order by workflowTrackingStatusTable.CreatedDateTime desc
where workflowTrackingStatusTable.ContextRecId == this.RecId
join User from workflowTrackingTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Submission;
this.ReportedAsReadyBy = workflowTrackingTable.User;
//if(this.WorkflowApprovalStatus == LedgerJournalWFApprovalStatus::Approved)
{
select firstonly RecId from workflowTrackingStatusTable
order by workflowTrackingStatusTable.CreatedDateTime desc
where workflowTrackingStatusTable.ContextRecId == this.RecId
join User from workflowTrackingTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;
this.Approver = HcmWorker::userId2Worker(workflowTrackingTable.User);
}
if(this.WorkflowApprovalStatus == LedgerJournalWFApprovalStatus::Rejected)
{
select firstonly RecId from workflowTrackingStatusTable
order by workflowTrackingStatusTable.CreatedDateTime desc
where workflowTrackingStatusTable.ContextRecId == this.RecId
join User from workflowTrackingTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Rejection;
this.RejectedBy = workflowTrackingTable.User;
}
}
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment