05.10.2010, 22:05 | #1 |
Участник
|
workflowax: Workflow Wishlist #2 – onDelegateEvent
Источник: http://workflowax.wordpress.com/2010...delegateevent/
============== Wish: The second item on my wishlist for Dynamics AX workflow is to have an “onDelegateEventHandler” option available for tasks and approvals. I must admit that this would most probably not be a very widely used function within AX workflow, but here is why I would like to have one. Given the way that workflow manages the assignment of workitems, there is no way of determining when and to whom tasks are assigned to people, in order to perform some type of custom action like updating an external system or table. Even making use of custom ParticipantProviders, one does not have a guarantee that it will end up at the person that your provider class is returning, due to delegation settings. Thus an onDelegate event handler would be very useful. Unfortunately workflow does not have any eventhandlers for individual workitems, rather just set on tasks, so this may be difficult to accomplish. My workaround: It is relatively easy to tap into the WorkflowTrackingTable’s (Table) saveTracking Method and kick off some custom action using the record ‘trackingTable’. The trackingTable record contains a useful field called TrackingType (enum WorkflowTrackingType) which can provide you with more informations as to what has just occurred. E.g. WorkflowTrackingType::Delegate, WorkflowTrackingType::EscalationPath, WorkflowTrackingType::Creation. Using this you can then perform whatever action you would like to do e.g. if (trackingTable.TrackingContext == WorkflowTrackingContext::WorkItem) { if (trackingTable.TrackingType == WorkflowTrackingType::Creation) { doAction(trackingTable.User); //this is the user to whom the workitem has finally been assigned } else if ((trackinTable.TrackingType == WorkflowTrackingType::Delegation) || (trackingTable.TrackingType == WorkflowTrackingType::EscalationPath)) { doAction(trackingTable.ToUser); //to whom the workitem is now assigned (delegated/escalated) } } N.B. Be warned, you are modifying system classes so be careful when you are installing new hotfixes or upgrading. Happy Daxing Comments Suggestions? Workflow Wishlist: #1. canApprove / canReject Logic #2. onDelegateEvent Источник: http://workflowax.wordpress.com/2010...delegateevent/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|