Hi,
I was trying to approve Ledger Journal workflow item using this X++ code.
static void ApproveWorkflow(Args _args)
{
LedgerJournalId ledgerJournalId = 'GL-0000024';
LedgerJournalTable ledgerEntries = LedgerJournalTable::find (ledgerJournalId);
WorkflowWorkItemTable workflowWorkItemTable;
while select workflowWorkItemTable where
(workflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem) &&
(workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending) &&
workflowWorkItemTable.RefRecId == ledgerEntries.RecId &&
workflowWorkItemTable.RefTableId == ledgerEntries.TableId
{
WorkflowWorkItemActionManager::dispatchWorkItemAction(
workflowWorkItemTable,
"Approved via X++",
curUserId(),
WorkflowWorkItemActionType::Complete,
"LedgerJournalTable5",
false);
}
}
I always encountered this error when running this.
"Element outcome is not defined on the workflow element."
Can someone help the right way of approving workflow using X++. Specially approving multiple workflow items.
Thanks,
*This post is locked for comments
I have the same question (0)