Показать сообщение отдельно
Старый 27.10.2015, 12:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,491 / 846 (79) +++++++
Регистрация: 28.10.2006
workflowax: Determine if a document has an outstanding task.
Источник: https://workflowax.wordpress.com/201...standing-task/
==============

In AX2009 you used to have two different status for assigned Purchase Requisitions in workflow, namely: “Pending Completion” and “Pending Approval”. Unfortunately in AX2012 this has become simply “In Review” to signify it being in workflow. This allows a more flexible approach to the ordering and reuse of elements in workflow. However it does not provide a clear way to distinguish where the Purchase Requisition is currently in the workflow process especially whether or not the item is currently assigned as a task or an approval.

The code below provides the X++ select statement to determine whether a document in workflow has at least one pending Task based workitem linked to it.

public display NoYes isTask(){ WorkflowWorkItemTable workflowWorkItemTable; WorkflowElementTable workflowElementTable; select firstonly ElementId from workflowWorkItemTable where workflowWorkItemTable.RefTableId == this.TableId && workflowWorkItemTable.RefRecId == this.RecId && workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending join ElementId, ElementType from workflowElementTable where workflowElementTable.ElementId == workflowWorkItemTable.ElementId && workflowElementTable.ElementType == WorkflowElementType::Task; return (workflowWorkItemTable.RecId == 0) ? NoYes::No : NoYes::Yes;}Note: If you’re using line level workflows or parallel branches you may not be guaranteed that the result is what you are logically looking for. It will simply return if there is at least one pending task workitem linked.

This post was inspired by forum question: https://community.dynamics.com/ax/f/33/t/161105




Источник: https://workflowax.wordpress.com/201...standing-task/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.