Determine if a document has an outstanding task.

20 05 2015

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:


Subworkflow Tutorial

13 01 2014

Since the launch of Dynamics AX 2012 I’ve been amazed at the amount of really good blogs that have started springing up. One such blog is Collin’s Dynamics AX2012 blog. After finding a whole load of question on Subworkflows in Dynamics AX, I considered writing up an article, but found a his tutorial very way more helpful than I could ever be, so please pay his site a visit!

Collin’s Dynamics AX2012 Blog – Subworkflows

Setup User workflow email notifications in AX2012

23 08 2012

In order for users to be notified of new work-items that have been assigned to them you will need to ensure that they have their notification settings enabled. To do this you can follow the following procedure.

  • Navigate to the user options screen.
    • If this is for yourself, you can locate user options from the File -> Tools -> Options menu.
    • If this is for other users you can access the form via System Administration -> Common -> Users -> Select the correct user -> Click options on the toolbar
  • Select the notifications tab
  • Check the “Send notifications in email” checkbox. By default this is disabled.

N.B. Please ensure that you your email templates and outgoing mail server have also been configured and in AX.

AX 2012 Worflow Automates Key Processes

2 04 2012

Demo video featuring Karl Tolgu Program manager at Micorosoft explaining the use of Workflow in Microsoft Dynamics AX 2012.

Thanks to SIS Global for the upload.

‘Go to Origin’ Button for Workflow History Form

18 11 2011

For workflow administrators out there, you have no doubt found the need to jump from the workflow history form (Basic -> Periodic -> Workflow History) to the original document that the workflow relates to. Especially for debugging errors. So today’s post provides you with just that… A “Go to origin” button for your workflow history form.

Go to origin button on workflow history form

Seeing as this is a standard AX form, I don’t think I’m allowed to simply export and provide an XPO on my blog so here are the instructions on how to do it.

1. Open the form WorkflowStatus in the AOT.
2. Create a standard button at the following location on the form Designs -> Design -> Group -> GridGroup -> Button group called DrillDown with the label @SYS88047 in its text property.

Insert Button

Insert Button

3. Right click on the button’s method node, click Over ride method , Clicked.
4. Overwrite the method code with the following.

void clicked()
    Common buffer;
    selectableDataArea company = curExt();
    Args args = new Args();
    SysDictTable dictTable;
    FormRun formRun;
    WorkflowTrackingStatusTable trackingStatus;
    trackingStatus = WorkflowTrackingStatusTable::findByCorrelation(WorkflowTrackingStatusTable.CorrelationId);
    if (trackingStatus.RecId)
            dictTable = new SysDictTable(trackingStatus.ContextTableId);
            buffer = dictTable.makeRecord();
            select buffer where buffer.RecId == trackingStatus.ContextRecId;
            if (! buffer)
                 info('You cannot go to the origin of the workflow instance. The record no longer exists or you do not have sufficient access.');

            formRun = ClassFactory.formRunClass(args);

If you cannot read the above you can view it in this text file: clickedWF.txt

5. Save the form.
6. You’re done!! Quick and easy.

Disclaimer: Please note that this is really just an code suggestion and that you should test it thoroughly before introducing to any live environment.

How to run multiple Dyanamics AX workflow websites on IIS 7

10 12 2010

Previously I have written up a post on how to run multiple workflow websites on the same server. The instructions are pretty IIS 6.0 specific, so here is an update on how to do this on IIS 7.

Step 1 – Create a new business connector configuration
1. Click start, control panel, administrative tools, Microsoft Dynamics AX 2009 Configuration.
2. Select Busines Connector from “Configuration Target”
3. Click Manage, Create Configuration.
4. Provide an intuitive name for the business connector configuration e.g. AX2009_DEV. You will need to use this in a few minutes again, so make a note of it.
5. Click ok.
6. Select Connection tab, select the AOS that is already there and click edit.
7.  Provide the correct server name, instance name and TCP/IP port, click ok.
8. Click apply to save your new configuration.
9. Select your previously selected configuration and click ok (this is so that your already existing website will still work).

Step 2 – Duplicate the website files
1. Open up My Computer and navigate to c:/Program Files/Microsoft Dynamics AX/50
2. Duplicate the Workflow folder  and rename the new folder to something intuative like “WorkflowDev”
3. Edit the web.config file inside the newly created folder using Notepad or similar text editor.
4. Replace the line “<appSettings/>” with


5. Save and exit notepad

Step 3 – Create your website application pool
1. Open IIS Manager: Start, Control panel, Administrative Tools, Internet Information Services (IIS) Manager
2. Expand your server node, Click application pools.
3. Click add Application Pool (on the right)
4. Enter and Application pool name E.G. MicrosoftDynamicsAXWorkflow50Dev
5. Select .Net Framework v2.0.50727
6. Select Classic from the Managed pipeline mode.
7. Click ok to close.
8. Select your newly created application pool, click advanced settings.
9. Ensure that the managed Pipleine mode is set to classic.
10. Under Process Model -> Identity, click “…”, select custom account, click select, enter your bcproxy account details used for your previous workflow website. e.g. domain\bcproxy. Click ok to close, click ok to close the select window.
11.  Set the IdleTime-out (minutes) setting to 0.
12. Set Regular Time Inteval (minutes) (under Recycling section) to 0.
13. Click ok. Your application pool is now setup.

Step 4 – Create Application
1. In IIS Manager, expand the Sites node, expand “default website”
2. Right click on default website and click “Add Application”
3. Provide a name for your application e.g. MicrosoftDynamicsAXWorkflow50Dev
4. Select the application pool you created in step 3
5. Under the physical path node click … and browse to the folder you copied in step 2. e.g. C:/Program Files/Microsoft Dynamics AX/50/WorkflowDev, click ok
6. Ensure that your connect as settings are set to Pass-through authentication.
7. Click ok.

Step 5 – Select your website with AX.
1. In Dynamics AX 2009, naviagate to Administration -> Setup -> Workflow Infrastructure configuration wizard, under website select your new application that you created e.g. http://myserver:80/MicroftDynamicsAXWorkflow50Dev
2. Validate the website and complete the wizard.

You should now have multiple workflow websites running successfully in IIS 7.0

For more information on setting up your workflow infrastructure in dyanmics Ax 2009 check out this post.

Happy Daxing!

Demo leave application workflow template

15 11 2010

This last week I have been away in Kenya again doing some development training for Microsoft partners in the area. The last item of our training was a crash course in workflow development where we attempted to get through creating a Leave application workflow template including an associated form, table, status enum etc in the last afternoon of the training. For those of you who attended the training and would like to download the demo, please find the attached XPO (this is just a demo and has not intended for use in production at all).

To get this workflow to run you can following the following steps:
1. Import XPO into your environment.
2. Add the LeaveApplication menu item to one of your module menu’s (optional)
3.  Restart AX client
4. Open Workflow configurations under Accounts Payable -> Setup
5. Create a new configuration, by selecting new and then choosing ‘Leave application…’
6. Configure the workflow by providing the relevant instructions and assignee.
7. Open the Leave Application form and create records. Once saved these records should be available for submission to workflow. A yellow workflow bar should appear with a ‘Submit’ button
8. Click submit.
9. Run the form ‘tutorial_workflowprocessor’ under the forms node in your AOT to get your workitems to processs. Click start.
10. Refresh your Leave application form.
11. Check out your workflow history to confirm that the record has been processed.

Happy Daxing

XPO Download

%d bloggers like this: