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 Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

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

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading