October 30, 2014

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)
{
#AOT
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");
try
{
sysDictWorkflowType = SysDictWorkflowType::newTypeName(workflowName);
sysDictWorkflowCategory = new SysDictWorkflowCategory(sysDictWorkflowType.category());
info(sysDictWorkflowCategory.label() + ";"
+ sysDictWorkflowType.label() + ";"
+ sysDictWorkflowType.help());
}
catch ( Exception::Error)
{
exceptionTextFallThrough();
}
workFlowNode = workFlowNode.AOTnextSibling();
}
}

Your output must look like below

image
- Harry






No comments:

Post a Comment

Thanks