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)
    {
        changecompany(trackingStatus.ContextCompanyId)
        {
            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.');
return;
            }
            dictTable.formRef();
            args.lookupRecord(buffer);

            args.name(dictTable.formRef());
            formRun = ClassFactory.formRunClass(args);
            formRun.init();
            formRun.run();
            formRun.detach();
        }
    }
}

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

<appSettings>
<add key="BUSINESS_CONNECTOR_CONFIGURATION" value="[BUSINESS CONNECTOR NAME FROM STEP 1.4]" />
</appSettings>

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





Adding custom fields to workflow emails

26 08 2010

Hi all.
For today we are going to be taking a quick look at one of the ways in which you can add custom tags to your workflow emails. For example by default one does not have the option to display the name of the user whom the work item has been assigned to, but you may want to start out your email saying “Dear %assignedToName%” and have AX automatically populate this for you. One of the simplest ways to accomplish this is by customizing the EventNotificationWorkflow class. (Note: This is a framework class so be careful when upgrading).

Step 1 – Add a new method such as “void addCustomMergeValues()”
Step 2 – Add as the new tags that you would like to access by using the following format mergeValues.insert(“field1″,”myValue”); – in this case putting the tag %field1% in your email template, you final emails that are send out would be populated with “myValue”.
Step 3 – Call you custom method from the “sendMail” method of EventNotificationWorkflow. The best place to put this call would be directly below “this.addBaseMergeValues();” (line 25).

After doing this you should be able to freely use all your new tags in you email templates. Here is my example of how to insert the notification owner’s name into your template.

void addCustomMergeValues()
{
UserInfo user;
;
select user where user.Id==inbox.UserId;
mergeValues.insert('assignedToName',user.name);
}

Note: You can also add custom values from the record that the notification is for, by making use of global variable “record” available in EventNotification e.g.

if (record.TableId == purchTable.TableId)
{
    purchTable.data(record);
   mergeValues.insert("docKey",purchTable.PurchId)
} else if (record.TableId = purchReq.TableId)
{ 
   purchReq.data(record);
   mergeValues.insert("docKey",purchReq.PurchReqId");
}

Happy Daxing





Workflow Development Manual

29 07 2010

Two weeks ago now I reviewed the Installation and configuration document written by Sumit Loya for Microsoft Dynamics AX Workflow. As a followup, today I would like to mention one of the other useful sets of documentation that he has written. Namely “Workflows – Development - An easy to understand guide for creating new workflow templates in Microsoft Dynamics AX 2009″.

In this excellent document Sumit takes one through all the various artifacts and components that form a part of a Dynamics AX template, explaining why they exist and how you will be using them in your own customisations and/or creation of templates. He describes the various properties available for each component and their uses in a fair amount of depth (very handy if you’ve ever wondered what some of the more obscure properties do), providing examples as he goes.

The document also includes great sample code for the creation of your own WorkflowDocument, Action Manager, Event Handler and Workflow classes.

All in all if you want to have a thorough learning experience on how to create workflow templates. This document should most definitely be your starting point!!! You will be left with an in-depth understanding of not only how to create templates, but also of how the workflow components communicate and tie together.

Thanks again Sumit.

Check out the original post over here.
Download the document from Axaptapedia here.





Workflow in three Easy Steps – New tool by Amer

28 07 2010

As all you workflow developer’s know, creating new workflow templates is a huge job due to the large number of AOT objects that one has to create and link up. Amer has created a new tool to create new workflow templates in just 3 easy steps. Check it out over here. http://blog.amer-ax.com/?p=475

Congrats Amer. This is sure to help many many people.





Workflow Installation and Configuration Document

15 07 2010

The last couple of weeks, I have been receiving a number of useful links and resources related to Workflow in Dynamics AX 2009. This week I was pointed to two excellent resources on workflow, from a the “AXFactor” blog by Sumit Loya.

The first document deals with all the Installation and Configuration requirements for the workflow infrastructure in Dynamics AX 2009. It is very thorough and deals with, amongst other things, required user accounts and permissions, all the security issues that you will come across in both IIS and Dynamics, prerequisites for installation, installing the website, configuring batch inside AX and managing running Workflows. It is a definite must ready and handy reference book. After reading this document I felt like removing my post on Installation and Configuration, as Sumit is much more comprehensive and helpful. Thank-you for this excellent resource!!

View Original blog post at the AXSumit here
Download from Axaptapedia here

*UPDATE: Checkout the workflow development document too over here.








Follow

Get every new post delivered to your Inbox.

Join 254 other followers

%d bloggers like this: