Last active
June 27, 2022 13:14
-
-
Save d47447/67e0f7fc7ad28bc6219e9e955469b747 to your computer and use it in GitHub Desktop.
All about workflow manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void autoApproveWF(Common _common, str _user) | |
| { | |
| WorkflowWorkItemTable WorkflowWorkItemTable; | |
| select WorkflowWorkItemTable | |
| where workflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem | |
| && workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending | |
| && WorkflowWorkItemTable.RefTableId== _common.TableId | |
| && WorkflowWorkItemTable.RefRecId == _common.RecId; | |
| WorkflowWorkItemActionManager::dispatchWorkItemAction( | |
| WorkflowWorkItemTable, | |
| "Auto Approve by system", | |
| _user, | |
| WorkflowWorkItemActionType::Complete, | |
| menuitemDisplayStr(PurchReqTable)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public WorkflowUser currentWFUser(Common _common) | |
| { | |
| WorkflowTrackingStatusTable workflowTrackingStatusTable; | |
| WorkflowTrackingTable workflowTrackingTable; | |
| select firstonly RecId from workflowTrackingStatusTable | |
| join User from workflowTrackingTable | |
| order by WorkflowTrackingTable.CreatedDateTime desc | |
| where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId | |
| && workflowTrackingStatusTable.ContextRecId == _common.RecId | |
| && workflowTrackingStatusTable.ContextTableId == _common.TableId | |
| && workflowTrackingTable.TrackingContext == WorkflowTrackingContext::WorkItem; | |
| return workflowTrackingTable.User; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment