19.02.2010, 23:05 | #1 |
Участник
|
Muhammad Ali Khan: Close Service Activity On Create Message In PlugIn
Источник: http://malikhan.wordpress.com/2010/0...age-in-plugin/
============== Here is a simple code to close the service activity in a MS CRM Plugin. 1: SetStateServiceAppointmentRequest req = new SetStateServiceAppointmentRequest(); 2: req.ServiceAppointmentState = ServiceAppointmentState.Closed; 3: req.ServiceAppointmentStatus = 8; 4: req.EntityId = new Guid(context.OutputParameters["id"].ToString()); 5: SetStateServiceAppointmentResponse resp = (SetStateServiceAppointmentResponse)crmService.Execute(req); But the above code will work perfectly only if the message is Post Update but doesn’t work if the message is Post Create means it doesn’t close the service activity. Strangely, it doesn’t give any error as well. To add to my surprise, if you had configure any plugin on “SetState” or “SetStateDynamic” for serviceappointment even those plugin will be trigger, but the state of the service activity will not change. Why?, i am not sure. But does this means we cannot close service activity on the “Create” message?, well the trick is to register the above plug-in as Asynchronous mode (as shown below). now the above message will Close the Service Activity even on the Create Message. Источник: http://malikhan.wordpress.com/2010/0...age-in-plugin/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|