Workflow error messages “Invalid message sequence”

We often get following error messages concerning workflow:

Dynamics Adapter CallStaticClassMethod failed.
SysWorkflowEventService-onAcknowledgeWorkItem Invalid message sequence - missing Activation message.
Microsoft.Dynamics.BusinessConnectorNet.XppException
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.CallStaticClassMethod(String className, String methodName, Object[] paramList) at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsAdapter.CallStaticClassMethod(String className, String methodName, Object param1, Object param2)


When these occur, none of the workflow items are processed anymore. In Basic –> Inquiries –> Workflow history you can see that all workflow items has status “Pending”



Usually error SysWorkflowEventService-onAcknowledgeWorkItem Invalid message sequence - missing Activation message can mean two problems:


1. Business Connector connect to different AOS.
2. In Workflow configuration you did not create messages in user language.


To resolve first problem:


1. Go to Microsoft Dynamics AX 2009 Configuration
2. Change “configuration target” to “Business Connector (non-interactive use only)”
3. Check on connection tab if there is correct AOS mentioned
By default Workflow during connection to AOS is using active Dynamics AX BC.NET configuration.


To be able to set up different configuration in web.config you need to apply kernel hotfix and follow instruction given in KB 960801: https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb$EN-US$960801&wa=wsignin1.0


If you have hotfix KB 960801 installed and BC.NET still is connecting to wrong AOS please double check in GAC (usually C:\windows\assembly) if library Microsoft.Dynamics.Framework.BusinessConnector.dll and the Microsoft.Dynamics.Framework.Communications.dll has version higher than 5.0.1500.144 for DAX 2009 SP1 and 5.0.593.262 for DAX 2009 RTM


To resolve second problem make sure that you have instructions set up in user language in workflow configuration




Manage the State Service (SharePoint Server 2010)

The State Service is a shared service that is used by some Microsoft SharePoint Server 2010 components to store temporary data across related HTTP requests in a SQL Server database. In SharePoint Server 2010, the State Service is required by InfoPath Forms Services (including out of the box and custom workflow forms), the SharePoint Server 2010 Chart Web Part, and certain Microsoft Visio 2010 scenarios that do not use Microsoft Silverlight 3.

 
Configure the State Service


The State Service is automatically configured as part of the Basic installation of SharePoint Server 2010.

Advanced installation of SharePoint Server 2010 requires separate configuration of the State Service. You can configure the State Service after installation of SharePoint Server 2010 by using one of the following tools:
  • Farm Configuration Wizard
  • Windows PowerShell
 The default configuration for the State Service is the following:
   
  • One State Service service application.One State Service database on the same database server that contains the configuration database. The databases must be associated with the service application.
  • One State Service application proxy associated with the default proxy group of the server farm.
 The default configuration for the State Service is sufficient for most configurations. The following considerations might require additional configuration of the State Service:

 Hosted deployments Multiple deployments hosted on the same farm automatically partition forms and chart data so that tenants cannot see forms and charts of other tenants. Organizations that have policies requiring strict separation of hosted deployments might want to create new service applications and state databases for each deployment, with each service and database associated with a new Web application for the deployment. You should also closely monitor the performance of your hosted deployments, and consider creating new service applications and state databases when you anticipate performance issues with hosted deployments

 Scale for high-capacity use of forms or charts In rare cases, server farms with a very large number of InfoPath active state sessions for forms or charts might require additional State Service databases on the same service application to maintain capacity with acceptable performance. A database administrator that encounters performance issues such as excessive database locks can add databases to improve performance.

You can reconfigure the State Service after initial configuration by using Windows PowerShell.
  
Configure the State Service by using the Farm Configuration Wizard

After setup is finished, the opening page of the Farm Configuration Wizard opens automatically. The administrator can choose to run the wizard immediately or wait until later. In the Farm Configuration Wizard, all services that are not currently configured are selected for configuration by default. If you do not want to configure the State Service until later, you can clear the check box for the service and run the Farm Configuration Wizard later.

Note:
Until you configure the State Service, you will not be able to store session state data for forms, charts, and diagrams that use the State Service.

If the State Service check box is unavailable, it has already been configured. After initial configuration, you can only configure the State Service by using Windows PowerShell.
  To configure the State Service by using the Farm Configuration Wizard

1.On the Central Administration Web site, click Configuration Wizards.2.On the Configuration Wizards page, click Launch the Farm Configuration Wizard.
3.On the first page of the Farm Configuration Wizard, click Start the Wizard.
4.On the services configuration page, in the Services section, select the State Service check box.

Note: If the State Service check box is unavailable, the State Service is already configured. To make changes to the configuration you must use Windows PowerShell.
5.Click Next.
6.Complete any other configuration steps for the server farm.
7.On the final page of the Farm Configuration Wizard, click Finish.
Configure the State Service by using Windows PowerShell
The State Service can be configured by using Windows PowerShell. You can use Windows PowerShell during initial configuration instead of the Farm Configuration Wizard. You can also use Windows PowerShell to perform configuration tasks that are not available on the Central Administration site of the farm. The additional configuration tasks include:
Get information about a service application, database, or application proxy; or a list of all service applications, databases, and application proxies.
  • Change configuration parameters for a service application, database, or application proxy.
  • Pause and resume State Service databases.
  • Remove a State Service database.
  • Mount data to a database.
  • Install the State Service schema to an existing database, and change bindings between databases and service applications, or between proxies and proxy groups.Create State Service service applications and State Service Databases for hosted deployments. Create additional State Service databases for scaling high-capacity deployments for forms or charts, and associating them with the existing State Service service application.

 When you create a custom configuration of the State Service, consider the following points:
  •  A State Service service application is a container for one or more databases.
  • A State Service service application is bound to at least one State Service application proxy.
  • As with all Shared Services, State Service application proxies are bound to Web applications by using proxy groups.

Note:
If multiple State Service application proxies are in the same group, only the default application proxy will receive newly allocated data. All the application proxies with data are used during read operations.
   
For more information about configuring service applications, see Manage service applications (SharePoint Server 2010).
To configure the State Service by using Windows PowerShell
  
1.Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
2.On the Start menu, click All Programs.
3.Click Microsoft SharePoint 2010 Products.
4.Click SharePoint 2010 Management Shell.
5.To create a service application, type the following command:
   
6.To create a State Service database and associate it with a service application, type the following command:
  
Copy Code New-SPStateServiceDatabase -Name "" -ServiceApplication $serviceAppWhere is the name of the State Service database to create and associate with the service application.
Note:
You must have at least one State Service database for each State Service service application. You can create additional databases in the same service application to increase capacity for forms and charts. Every database must have a unique name.
The previous command uses the default database instance on the farm and default database credentials. For more information about how to specify a different database server or database credentials, see New-SPStateServiceDatabase.
7.To create a State Service application proxy, associate it with the service application, add it to the farm's default proxy group, and type the following command:
Copy Code New-SPStateServiceApplicationProxy -Name "" -ServiceApplication $serviceApp -DefaultProxyGroupWhere is the name of the application proxy.
Note:
If you do not want to add the State Service application proxy to the default proxy group, do not specify the DefaultProxyGroup parameter.
  
For more information, see New-SPStateServiceApplication, New-SPStateServiceDatabase, and New-SPStateServiceApplicationProxy.
  
For more information about the available State Service cmdlets, see State service and session state cmdlets (SharePoint Server 2010).
  
Monitoring the State Service
Administrators can monitor the State Service by using the SharePoint Monitoring and Event reporting service. Monitoring the service can help confirm the service was properly configured and can also identify any configuration or setup issues associated with the service.
For more information about how to monitor performance of the State Service, see Health monitoring (SharePoint Server 2010).
Note:

Copy Code $serviceApp = New-SPStateServiceApplication -Name ""Where is the name for the service application.
You must have at least one service application for the State Service. In hosted deployments, each hosted partition can have its own service application, but it’s not necessary. The name of the service application must be unique. If you are creating an additional service application, you must replace the name text with a unique name.