CRM 2011 Workflow “Invalid Pointer” error

前端 未结 2 341
梦毁少年i
梦毁少年i 2021-01-12 00:01

I have a custom workflow in CRM 2011 which is manually triggered against custom entity records. When a single record is selected for processing, the workflow is always succ

2条回答
  •  终归单人心
    2021-01-12 00:36

    It seems this error message is a round-about way of saying, 'tried to open another connection to CRM when the previous one was open', and the reason it tries to do this is very much relevant to the fact it only fails when processing more than one record.

    Reference this blog:

    It seems that when a workflow is run against multiple records, it uses the same instance of the class, which means that class-level variables won't be re-instantiated between executions. So, when subsequent executions come to the code which sets the class-level service variable to an instance of an IOrganisationService, it finds the variables already has one and that it's open.

    The solution I've found easiest to implement it to have the service variable within the Execute function, rather than class-level. This has solved the problem everywhere that I've tried it since.

提交回复
热议问题