![]() |
#1 |
Участник
|
workflowax: Adding custom fields to workflow emails
Источник: http://workflowax.wordpress.com/2010...rkflow-emails/
============== 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 ![]() Источник: http://workflowax.wordpress.com/2010...rkflow-emails/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|