Upcoming AX2012 Workflow Apps and Features

10 04 2013

I was recently pointed to this video http://www.youtube.com/watch?feature=player_embedded&v=UJpCe_7sk0k from msdyncomm highlighting some very cool upcoming features for workflow in Dynamics AX 2012. I reviewed it this morning and was very encouraged to see the direction that workflow is going in. Workflow should make users lives simpler and more streamlined and the features highlighted will certainly go a long way in accomplishing this goal.





Customize your AX Workflow Email Templates

12 12 2012

A number of our clients have made requests of us to provide more meaningful information available on the Email notifications that are sent to the workflow work-item assignees. The typical information that they would like to see is line item information for workflow relating to Purchase Requisitions etc.

The easiest way is to modify the various task and step instructions in your workflow configuration. You can select tags relating to the lines such as %Purchase Requisition.Purchase requisition lines.ItemId% etc. These instructions can be displayed in your workflow email notification by including the %message% tag in your email template.

Screen Shot 2012-12-12 at 10.11.38 AM

However using this approach is not very flexible or visually appealing as each tag is replaced by a comma separated list of the values from the various lines. Most of our clients have required a more tabular format for the lines. My approach to solving their issue is by using a code based solution that I will describe below.

I’d like to say at the outset that the disadvantages to this approach is that it doesn’t easily allow for multi-language, its fairly rigid, and it is a more hard-coded solution making it not very flexible.

Step 1. Create a method ‘wfDescription’.

Create a ‘wfDescription’ method on each Workflow Document table that you are using. This method should return an block of html (or plain text) with the content that you would like to display for the given document type. E.G. For a purchase requisition add the following method to the PurchReqTable table.

str wfDescription() 
{
 PurchReqLine line;
 str ret="";
 ;
 ret = ret + strfmt("<strong>Motivation: </strong>%1<br/>", this.businessJustification()); ret = ret + "<strong>Lines:</strong><br/>";
 while select line where line.PurchReqId==this.PurchReqId
 {
   ret = ret + strfmt("%1. %2 <span style='color: #009966'> (%3 @ %4 %5) - %6</span><br/>",num2str(line.LineNum,0,0,1,3), line.itemName(), line.PurchQty, line.CurrencyCode, line.PurchPrice, line.LedgerAccount);
 }
 return ret;
}

Step 2: Add a description tag to your email template

Open up your email template and place a %documentdescription% tag in the place where you would like the text/html block from Step 1 to appear in your emails.

Step 3: Enable the %documentdescription% tage

This is the key step in the whole process. To enable workflow to replace the new %documentdescription% tag created in Step2 with the contents from the method in Step 1. To do this we will be customizing the ‘EventNotificationWorkflow’ class:

  • Open the ‘EventNotificationWorkflow’ class.
  • Edit the sendMail method.
  • Add the line ‘this.addCustomMergeValues();’ after the line ‘this.addBaseMergeValues();’
  • Create a new method named ‘private void addCustomMergeValues()’ to the ‘EventNotificationWorkflow’ class.
    This method will determine whether the workflow document has the ‘wfDescription’ method and will replace the tag with what the method returns.
private void addCustomMergeValues2()
{
  SysDictTable dictTable; 
  str description;
  ;
  dictTable = new SysDictTable(tablenum(PurchReqTable));

  if (dictTable.isMethodActual('wfDescription'))
  {
     description = dictTable.callObject('wfDescription',record);
  }
  else
  {
    description = "";
  }
  mergeValues.insert("documentdescription", description);
}

The final step is to prevent the html from your return method from being escaped. To do so:

  • Open up the SysEmailTable (Table) in the AOT
  • edit the HTMLEncodeParameters method
  • Add a conditional statement before the line ‘encodedMap.insert(mapEnum.currentKey(), SysEmailTable::htmlEncode(mapEnum.currentValue()));’ so that your new tag %documentdescription% is not html encoded.
if (mapEnum.currentKey() == 'documentdescription')
    encodedMap.insert(mapEnum.currentKey(), mapEnum.currentValue());
else 
    encodedMap.insert(mapEnum.currentKey(), SysEmailTable::htmlEncode(mapEnum.currentValue()));

If all goes well you should now receive more detailed information in your email notification.
Let me know if you have any better ways of accomplishing this or comments on my solution.

Happy daxing.





Assign Workitems based on document field

28 11 2012

I received a query yesterday from a reader asking how one could go about assigning approval work items to different users based on specific fields in the source document. There are a couple of approaches that you could use. The first approach that I will discuss today is ideal to use in the following circumstances.

  1. You do not wish to perform any development.
  2. There are not too many combinations available. E.G. Assign all blanket Purchase orders to person X and all the rest to person Y.

If you are using AX 2012, you can do the following:

  1. Create a new workflow configuration from whichever template you are basing your workflow configuration off.
  2. Drag and drop a conditional decision node into your workflow configuration to split your workflow into multiple paths.
  3. Configure your conditional decision by clicking properties. Then setup a condition E.G. Where Ledger Journal Table.Account Type is value Ledger
  4. Close the conditional decision properties.
  5. Drag and drop two of your approval/task nodes to the workflow structure.
  6. Connect the true side of your conditional statement to the one and the false side to the other.
  7. Configure your approval nodes.
    1. Double click on the node connected to your True leg of the conditional statement select Step 1, click the assignment button.
    2. Select “User” under the “Assignment Type” tab.
    3. Select the User / Users who should be assigned the workitem if your condition is met.
    4. Setup your workflow messages for the step.
    5. Return to your workflow canvas and perform step 1-4 for the false leg of your conditional decision, selecting the relevant user to whom the workitem should be sent to if the conditional decision is not met.
  8. Should you have more than two options, you can chain multiple conditional decisions to either the true or false leg of your original decision.

Here is a short video tutorial for the above making use of AX2012 and the Vendor Disbursement Journal Workflow. I’d recommend watching it in HD.

As an alternate to the above approach, or if you are using AX2009, you can also make use of multiple steps within a single approval. (This example is using AX2012, but a similar path is followed with AX2009)

  1. Create a workflow configuration with an approval node.
  2. Double click on your approval node
  3. Click on Step1, click the Condition button.
  4. Select the “Run this step only when the following conditions are met.”
  5. Create a condition.
  6. Select the Assignment option on the left of your screen.
  7. Select “User” on Assignment type
  8. Select the User / Users who should be assigned the workitem if your condition is met.
  9. Close Step1’s properties.
  10. Drag and drop a new step from your tool box into the process flow and repeat step 1-9 for each of the conditions required.
  11. Ensure that all possibilities are met.

Here is a short video tutorial for the above making use of AX2012 and the Vendor Disbursement Journal Workflow  I’d recommend watching it in HD.





AX2012 Purchase Order Workflow Training Video

13 11 2012

I recently came across the following very helpful video from Microsoft’s information source website relating to the “Approval Process for Purchase Orders”

It provides a nice overview of the capabilities of the Purchase Order approval process in Microsoft Dynamics AX 2012 for both line level and header level approval. The narrator takes you through the Purchase order state model and explains details behind each status that the Purchase order goes through and what actions are available to users at each point.

Mention is made of the various budget and encumbrance controls available to users as well as the versioning system for Purchase Orders.

You can view it at Microsoft’s information source website by with this link or by clicking on Library, Microsoft Dynamics AX2012, Search for “Approval Process for Purchase Orders.





“Stopped (error) X++ exception: the condition could not be evaluated” in Microsoft Dynamics AX 2012

31 10 2012

Just found a Knowledge base article that deals with the issue: “Stopped (error) X++ exception: the condition could not be evaluated” error message when you try to view workflow details in Microsoft Dynamics AX 2012

You can find the issue here: https://mbs2.microsoft.com/Knowledgebase/kbdisplay.aspx?scid=kb,EN-US,2657380

Although I haven’t experienced this issue myself I’m reposting it for anyone else who might be experiencing the problem.





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.





Organisation-wide Workflow Email Templates

22 08 2012

If you make use of organisation wide workflow configurations in AX2012 you may have come across an issue where users are not notified of their new work-items via Email.

To set this up you will need to:

1. Navigate to your email templates under the Setup menu of “Organisation Administration”.
2. Select the “Show system email templates”
3. Create a new Email template.

Image

4. Navigate to “System Administration” -> “Setup” -> “Workflow Parameters” and select your newly created email template. (For company specific configuration AX looks at the template selected under “Organisation Administration” -> Setup -> Workflow Parameters)

Your users should now be notified of “Organisation-wide” workflow workitems.





Cumulative Rollup 3

17 07 2012

For all of those out there who don’t yet know this, CU3 for Dynamics AX 2012 has been released with a number of hotfixes that fix various workflow issues. The majority of the issues seem to center around specific workflow types in CRM, AP Invoicing, AP and Purchase Requisitions.

However there are some fixes with the framework including a fix to an issue that forced the workflow execution account to be in en-us language and a fix for workflows submitted in companies that are not the default for the workflow batch job.

You can access the Update and knowledge base article here: https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2709934 (Partnersource login required)





Microsoft Dynamics AX 2012 Development Cookbook

27 06 2012

I recently came across this review for the Microsoft Dynamics AX 2012 Development Cookbook

http://www.wowebook.be/book/microsoft-dynamics-ax-2012-development-cookbook/

We’ve benefited in the past from its AX 2009 counterpart and are looking forward to using it in AX2012 as well.

You can get it on amazon at here





Installation and Configuration

15 05 2012

I’ve just completed reading through the installation and configuration manual for AX2012 and came across chapter 5 on workflow. This chapter is a must read for anyone starting out in workflow on Microsoft Dynamics AX2012. It covers/explains all the topics that one needs to know about workflow (apart from the development side) including:

  1. Descriptions of all the available workflow types (previously templates) from the following modules
    1. Accounts Payable (Invoiceing, payments, remittance etc..)
    2. Accounts Recievable (Journals, Free text invoices, customer payments etc…)
    3. General Ledger and Fixed Asset workflows
    4. Budgeting
    5. Travel and Expense (Cash advance, expense report, travel, dispute management etc…)
    6. Procurement and Sourcing (Catalogs, Purchase requisitions, Purchase Orders, Vendor modifications etc…)
    7. Project Management and Accounting
    8. User management
    9. Organisation workflows.
  2. Configuring the workflow environment
    1. Email templates (both generic and configuration specific templates)
    2. Batch Job setups
    3. Notification setups
    4. Workflow queue setups
    5. Explanation of the workflow infrastructure and how all the components interact with each other.
  3. Creating configurations
    1. Line level workflows
    2. Conditional and manual decisions
    3. The graphical workflow configuration utility
    4. Workitem assignments (queues, hierarchies, workflow users, workflow roles)
    5. Approval policies
    6. Versioning.

All in all this manual is well worth the read for first time users.

Happy Daxing

Download at partnersource: https://mbs.microsoft.com/partnersource/communities/training/trainingmaterials/student/course80221.htm?printpage=false