![]() |
#1 |
Участник
|
workflowax: Customize your AX Workflow Email Templates
Источник: http://workflowax.wordpress.com/2012...ail-templates/
============== 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. ![]() 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("Motivation: %1 ", this.businessJustification()); ret = ret + "Lines: "; while select line where line.PurchReqId==this.PurchReqId { ret = ret + strfmt("%1. %2 (%3 @ %4 %5) - %6 ",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:
Let me know if you have any better ways of accomplishing this or comments on my solution. Happy daxing. ![]() Источник: http://workflowax.wordpress.com/2012...ail-templates/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|