When does the SetStateDynamicEntity message occur?
-
15. marts 2012 14:16
Hi, I have a plugin registered on crm 2011 with two post-operation asynchronous steps, one for SetState and the other for SetStateDynamicEntity. I was under the impression that one or the other will trigger when the entities' state is changed. The messages are registered for the task entity. This works as intended on both my development and production organization. But the SetStateDynamicEntity message occurs twice on my production organization, once when the state is changed and again after what seems to be a random interval(I've seen the duplicate right after the original and up to 30 minutes later). The arrows in the image below show the original message and the duplicate message events.
To make matters worse, yesterday this message occurred on almost all the tasks in the database at the same time. I have verified that none of the plugins change any entities states so there is no possibility of a plugin to trigger one of these messages. And when looking at the audit history for any of the tasks this has occurred on, I find that the last time the task was updated in any way was when the original state message triggered. The image below shows the audit history for the same message events highlighted in the previous image.
Currently I cannot replicate this on my development organization nor on other entities. I have two custom entities with plugins registered the same way which only trigger the message once. At this point I have to assume that the message can occur more than once per state change, in which case I need to know why or what triggers it. Or there is something seriously wrong with my crm organization.
Has anyone encountered this or have any suggestions to solve or troubleshoot further? Any help would be appreciated.
Alle besvarelser
-
15. marts 2012 15:51
Hi
According my understanding DynamicEntity are obsolute in Crm 2011 ,
As CRm 4.0 Plugin are still supported in 2011 I guess they are there for backward compatibility
Also have a look at this Post for better understanding on SetStateDynamicEntity
http://social.microsoft.com/Forums/en/crmdevelopment/thread/6bfbbdfd-6f96-44ac-85ea-9a2bab378637
hth
dkay
if the response answered your question, please take a minute and mark the response as an answer.
-
15. marts 2012 16:10
Thanks for the reply. I'm assuming that you are saying that the SetStateDynamicEntity is obsolete? If so, I find it hard that believe due to almost all the events triggered from the built in activity button 'Mark Complete' show as using the SetStateDynamicEntity step i have registered. If this truly is obsolete, I then have to wonder why my organization is using the wrong message.
On the other hand, maybe the built in 'Mark Complete' button messages never got updated and are still using the Crm 4 messages. Nonetheless, this does not explain why this message is occurring twice for the same state change.
-
15. marts 2012 20:18
Maybe a (Custom-) Workflow issue?
I am using only SetStateDynamicEntity-Message an i never had any problems.
Regards,
MK
-
15. marts 2012 21:06
Good suggestion, but we have no workflows that are currently activated. I also checked if there are any workflows that executed against these tasks, but there aren't any.
I feel the same way about the set state. On my development organization I tested these plugins extensively triggering with those messages and never encountered any problems. This seems to only plague my production instance of crm, and only on tasks at that.
-
21. marts 2012 09:35
Hi
Did this help?
Please make sure to mark as answer to the response that helped you get through. This will help others with similar problem identify the answer and also close this thread as resolved.
Thanks
Dkay
-
26. marts 2012 19:27
The question has not been answered as of yet. I'll post how I'm currently getting around the issue, but I still can't figure out why the same event is occurring twice for a single action.
My current workaround for the issue is to test if the current event is the first to occur.
Dim Q As New QueryExpression(Crm.AsyncOperation.EntityLogicalName) Q.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, Task.Id) Q.AddOrder("startedon", OrderType.Ascending) Dim R = Service.RetrieveMultiple(Q) If R.Entities.Count > 1 Then If R.Entities.First.Id <> LocalContext.PluginExecutionContext.OperationId Then Throw New Exception("This is a duplicate event and has already been processed by operationid " & R.Entities.First.Id.ToString) End If End IfThis workaround works for now, but only because our tasks have no way of being marked as 'Open' after being marked as 'Completed'. This will get a lot more complicated if an entity that can be reopened is affected by this issue.
-
5. april 2012 13:51I'm going to chalk this one up to an odd bug in the system. Even after removing all plugins and workflows, the problem still occurs. I was able to resolve the issue by removing the organization in question, and import that organizations database as a new organization. I'm not sure what exactly is done to the database during an import, other than changing the organizationid, but this did fix the issue and there are no more duplicating events.
- Markeret som svar af tasadardevil 5. april 2012 13:57
- Afmarkeret som svar af tasadardevil 18. maj 2012 14:50
-
2. maj 2012 08:32
Thanks for your tip. We have similar problem: Activities "telephone call" sets automatically statuscode every half hour. We do off all proceses, workflow, system tasks, but activities are still setting automaticaly on bad staus.
We tried removing and import organization, we did update, but first result is bad, mistake still exist. We tried it again. Sadly, unknown hiden proces is still reseting the status automatically :(. We have a ghost in our system.
-
18. maj 2012 14:50
Good news, and bad news. I was wrong in my last post, the re-importing of the organization did not fix the issue. The issue came back and occurred only during business hours on certain days, giving me a bit of a pattern to follow. And to clarify, the issue is not actually a duplicate event, but the status being changed to Completed a second time, causing a second event. This doesn't show up in the audit history because nothing actually changes. I found this out after canceling a completed task, only to have it re-complete itself later on. I found the root cause to be the crm for outlook client. It only appeared as if reimporting the organization worked due to when the employees that use the outlook client were in the office and had outlook open.
I can now replicate this 100% on my development environment. In my test, I completed some tasks from my outlook client and forced a sync. I then canceled those tasks from IE as the crm admin. And when I forced a sync again in outlook, the tasks were re-completed. The problem seems to be that the older change set is being prioritized over the newer change set in this situation. Currently I have no way to fix it other than not using the outlook client.
Any suggestions?
@Jiri: If you're using the crm for outlook client, you're probably running into the same issue. Our company only uses the tasks and not phone calls, but I would assume that this would work the same way.