Источник:
https://dynamicsaxinsight.wordpress....workflow-in-x/
==============
Purpose:
In this post we’re going to learn how can we submit a pending vendor invoice to approval workflow in X++.
Application:
Dynamics 365 for Finance and Operations
Business requirement:
Submit a pending vendor invoice to approval workflow in X++.
Solution:
We can use the code below to submit a pending vendor invoice to approval workflow.
Code
/// /// Submits vendor invoice to workflow./// public static void main(Args _args){ WorkflowComment workflowComment; TradeLineRefId headerReference; VendInvoiceInfoTable vendInvoiceInfoTable; headerReference = "COMP-011202"; workflowComment = "Auto submission to workflow."; vendInvoiceInfoTable = VendInvoiceInfoTable::findTableRefId(headerReference); if (vendInvoiceInfoTable) { try { VendInvoiceHeaderWorkflow::submitToWorkflow(vendInvoiceInfoTable, workflowComment); } catch (Exception::CLRError) { System.Exception interopException = CLRInterop::getLastException(); error(strFmt("%1", interopException)); } catch (Exception::Error) { error(strFmt("An error occured during the update.")); } }}
Источник:
https://dynamicsaxinsight.wordpress....workflow-in-x/