web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Custom workflow setup for work item queue

(0) ShareShare
ReportReport
Posted on by 1,270

Hi,

 I've got a custom workflow which I have setup to be used with work item queues (i.e. I simply put [WorkflowDocIsQueueEnabledAttribute(true, "Quality Orders")] before the workflow document class.  This allows the workflow to run fine however when I go to home/Work Items/ Work items assigned to my queues I don't see the workflows associated with the Quality order queues.

I think the answer has something to do with the WorkflowQueueCreatedEventHandler which should be creating records in the WorkflowQueueDocumentCommonFields table (this table is joined to when viewing the 'Work items assigned to my queues' page).

 I've tried replicating the class PurchTableTaskCreatedEventHandler which extends WorkflowQueueCreatedEventHandler but this doesn't seem to work.  When putting purchase orders into a queue I can catch breakpoints in this code but not when I do the same thing for my custom quality order workflow.

 My knowledge on event handling is not that good.  I'm not sure exactly how the system knows to trigger my particular class Can anyone tell me what else I'd need to do to trigger this event handler and run my custom class (essentially a duplicate of PurchTableTaskCreatedEventHandler) to populate the WorkflowQueueDocumentCommonFields?

Alternatively, I may be on completely the wrong track here and someone can point me in the right direction as to how to get my items to appear in 'Work items assigned to my queues'

Thanks

David

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Rose Profile Picture
    1,270 on at

    Managed to work this out today.  So the process for getting a custom workflow to cooperate with work items queues is:

    1)      First problem.  The Quality Order document is not available for selection in the work item queue.  See below.

              To fix this we simply need an attribute on the workflow document class.  i.e

     [WorkflowDocIsQueueEnabledAttribute(true, "Quality Orders")]

    class InventQualityOrderWorkflowDocument extends WorkflowDocument

    {

    }

    Now we can create a work item queue based on this document.

    2) As described in my original question I was not able to see my waiting work items.

    1)      After looking at the datasources on this form for quite some time I tracked it down to being a problem with the WorkflowQueueDocumentCommonFields table not getting populated.  The population of this table occurs when the class WorkflowQueueCreatedEventHandler is triggered by the Work Items Created Event being setoff in the workflow.

     

    The answer to this was to create the following class:

     class InventQualityOrdeTaskCreatedEventHandler extends WorkflowQueueCreatedEventHandler

    {

    }

                                   

     

    protected void mapFields()

    {

                #Workflow

     

        InventQualityOrderTable   inventQualityOrderTable;

        WorkflowDocIsQueueEnabledAttribute attribute;

        DictClass       dictClass;

     

        dictClass = new DictClass(classNum(PurchTableDocument));

        attribute = dictClass.getAttribute(#WorkflowDocumentAttribute);

     

        inventQualityOrderTable = InventQualityOrderTable::findRecId(this.parmWorkflowWorkitemTable().RefRecId);

     

        this.parmDocumentId(inventQualityOrderTable.QualityOrderId);

        this.parmDocumentType(attribute.parmFriendlyName());

        this.parmCompanyInfo(inventQualityOrderTable.company());

     

    }

     

    NB: This was based on classes\PurchTableTaskCreatedEventHandler.

     

    This class extends WorkflowQueueCreatedEventHandler which in turn implements WorkflowWorkItemsCreatedEventHandler. 

    In order to trigger this event you must point the workflow tasks to the above class.

    Find the task under AOT/Workflow/Tasks.  Look for the property WorkItemsCreatedEventHandler.  Put the name of your event handler in here. (in my case InventQualityOrdeTaskCreatedEventHandler).

    Now this gets triggered when the work item is created, the WorkflowQueueDocumentCommonFields will be populated and the work items will show in home/Work Items/ Work items assigned to my queues

    Hope this helps someone else in the future.

  • Community Member Profile Picture
    on at

    Thank you for this post David - it has taken a lot of guess work out of why the work items aren't being shown for our custom workflow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans