SharePoint 2016 : Workflows – resolving error :”The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.” PowerShell script to create “State Service” service application

SharePoint 2016 : PowerShell script to create State Service application
SharePoint 2016 : PowerShell script to create State Service application

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Today new issue and solution 🙂

Details / Background :

  1. We have migrated our SharePoint 2013 site to our new SharePoint 2016 server
  2. We have around 5 workflows to be migrated
  3. Our workflows are migrated successfully 🙂
  4. But to test workflows when we starting workflows we are getting an error / issue related to “State Service” service application

Error / Issue 1:

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service.

Error / Issue 2: – This below error is can be seen in Health Analyser as well

InfoPath Forms Services forms can not be filled out in a Web browser because no State Service connection is configured

SharePoint 2016 - error - "InfoPath Forms Services forms can not be filled out in a Web browser because no State Service connection is configured"
fig : SharePoint 2016 – error – “InfoPath Forms Services forms can not be filled out in a Web browser because no State Service connection is configured”

Solution :

  1. It seems that “State Service” service application is not created / configured on our new SharePoint 2016 server
  2. By default “State Service” service application is not available to create from – Service application page – in Central Administration
  3. So we created “State Service” service application using PowerShell
  4. As “State Service” service application is created, we are able to see the workflow – can be started

What is “State Service” service application ?

  1. State Service” is a shared service used by some of the features of SharePoint like InfoPath forms – having OOB and custom workflow forms
  2. This service is used to store temporary data related to HTTP requests in SQL server database
  3. Also, State Service must be properly configured for the Search Administration Crawl and Query Health Reports to work properly

Creating State Service application :

  1. There are only two possible ways to create “State Service” service application
    • Executing SharePoint Farm Configuration Wizard
    • PowerShell script
  2. In this article we will discuss second approach – PowerShell script

Step by Step powerShell script to create “State Service” application :

  • Create new “State Service” service application using CMDLET – New-SPStateServiceApplication

New-SPStateServiceApplication
   [-Name] <String>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-Database <SPStateDatabasePipeBind>]
   [<CommonParameters>]

#Create new "State Service" application
$StateService_application = New-SPStateServiceApplication -Name "State Service"

  • Create database for “State Service” service application using CMDLET – New-SPStateServiceDatabase
New-SPStateServiceDatabase
   [-Name] <String>
   [-AssignmentCollection <SPAssignmentCollection>]
   [-DatabaseCredentials <PSCredential>]
   [-DatabaseServer <String>]
   [-ServiceApplication <SPStateServiceApplicationPipeBind>]
   [-Weight <Int32>]
   [<CommonParameters>]

#Create DB for State Service Application
$StateService_applicationDB= New-SPStateServiceDatabase -Name "KnowledgeJunction_SP_StateService" -ServiceApplication $StateService_application

  • Create a proxy for “State Service” service application using CMDLET – New-SPStateServiceApplicationProxy
#Create proxy for State Service application
New-SPStateServiceApplicationProxy -Name "KnowledgeJunction_SP_StateService" -ServiceApplication $StateService_application -DefaultProxyGroup

  • Initialize the “State Service” service application DB using CMDLET – Initialize-SPStateServiceDatabase
Initialize-SPStateServiceDatabase -Identity $StateService_applicationDB

Complete PowerShell script for creating “State Service” service application :

#Create new "State Service" application
$StateService_application = New-SPStateServiceApplication -Name "State Service"

#Create DB for State Service Application
$StateService_applicationDB= New-SPStateServiceDatabase -Name "KnowledgeJunction_SP_StateService" -ServiceApplication $StateService_application

#Create proxy for State Service application
New-SPStateServiceApplicationProxy -Name "KnowledgeJunction_SP_StateService" -ServiceApplication $StateService_application -DefaultProxyGroup

Initialize-SPStateServiceDatabase -Identity $StateService_applicationDB
SharePoint 2016 - PowerShell script for creating "State Service" application
fig : SharePoint 2016 – PowerShell script for creating “State Service” application
  • We could verify our service from “Central Administration” – service application page – _admin/ServiceApplications.aspx/

SharePoint 2016 - newly created "State Service" application
fig : SharePoint 2016 – newly created “State Service” application

Thanks for reading 🙂 HAVE A GREAT TIME AHAEAD 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: