Axapta V/s Me

Yet another blog for Dynamics 365 for Finance and Operations. This blog primarily targets the technical readers. I will be sharing my experience with Dynamics AX using code snippets, errors, and solutions, Tips, and tricks.

Get Default Workflow list in AX 2012

How to Fetch Default Workflow list in AX 2012

Hi Folks,

Here is a job to fetch existing workflows in AX 2012.

static void TheAxapta_WFList(Args _args)
Treenode                workflowTypesNode, workFlowNode;
int                     i;
int                     nodeCount;
str                     workflowName;
SysDictWorkflowType     sysDictWorkflowType;
SysDictWorkflowCategory sysDictWorkflowCategory;
workflowTypesNode = treenode::findNode(#WorkflowTypesPath);
nodeCount = workflowTypesNode.AOTchildNodeCount();
workFlowNode = workflowTypesNode.AOTfirstChild();
for (i=1; i<=nodeCount; ++i)
workflowName = workFlowNode.AOTgetProperty("Name");
sysDictWorkflowType = SysDictWorkflowType::newTypeName(workflowName);
sysDictWorkflowCategory = new SysDictWorkflowCategory(sysDictWorkflowType.category());
info(sysDictWorkflowCategory.label() + ";"
+ sysDictWorkflowType.label() + ";"
catch ( Exception::Error)
workFlowNode = workFlowNode.AOTnextSibling();

Your output must look like below

- Harry

No comments:

Post a Comment


Note: Only a member of this blog may post a comment.