internal final class NW_AutoApproveWF
{
public UserId GetSetpUser(Common Table)
{
WorkflowTrackingStatusTable WorkflowTrackingStatusTable;
WorkflowTrackingTable WorkflowTrackingTable;
select firstonly WorkflowTrackingStatusTable
join WorkflowTrackingTable
order by WorkflowTrackingTable.CreatedDateTime desc
where WorkflowTrackingTable.WorkflowTrackingStatusTable == WorkflowTrackingStatusTable.RecId
&& WorkflowTrackingStatusTable.ContextTableId == Table.TableId
&& WorkflowTrackingStatusTable.ContextRecId == Table.RecId
&& WorkflowTrackingTable.TrackingContext == WorkflowTrackingContext::WorkItem;
return WorkflowTrackingTable.User;
}
public void AutoApprove(Common Table, str Comment, str menuItem)
{
WorkflowWorkItemTable WorkflowWorkItemTable;
;
select WorkflowWorkItemTable
where WorkflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem
&& WorkflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
&& WorkflowWorkItemTable.RefTableId == Table.TableId
&& WorkflowWorkItemTable.RefRecId == Table.RecId;
WorkflowWorkItemActionManager::dispatchWorkItemAction(
WorkflowWorkItemTable,
Comment,
this.GetSetpUser(Table),
WorkflowWorkItemActionType::Complete,
menuItem);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter