Thursday, May 23, 2013

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

Hi there,

I was having a requirement to create SharePoint 2013 approval workflow using 2010 template. workflow was attached to content type.
Issue I was facing, while going to start the workflow it gives error of "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"

After some research came to find the solution,  this is related to state service as mentioned in error above.

Paste following commands in SharePoint management shell:

 $serviceApp = New-SPStateServiceApplication -Name "State Service"  
 New-SPStateServiceDatabase -Name "StateServiceDatabase" -ServiceApplication $serviceApp  
 New-SPStateServiceApplicationProxy -Name "State Service" -ServiceApplication $serviceApp -DefaultProxyGroup  


And now again I tried to start the workflow, and it started successfully!

Thursday, May 16, 2013

SharePoint 2013 Workflow error : Custom outcome column returns default option as a task result


I was facing weird issue in SharePoint 2013 Designer workflow.
Scenario was,
I wanted to create one list workflow where custom list was created programmatically and having my custom workflow task list created through code as well custom content type and outcome columns also created programmatically.
Now in workflow stage having an Assign task action and in Outcome options using the above created content type and site columns, see the figure below:


Issue here I was facing, Task result was always showing "TaskOutcome:0" i.e the default Outcome in task inspite of I selected any another option.
example in above figure result was always coming "Action Plan Created".

Tried different approaches to make it work:

-While debugging tried various options to make it work, like installed update http://support.microsoft.com/kb/2767999
where it mentioned that
"Assume that you use non-ASCII characters to name a task outcome field in a task in a custom workflow. Then, you change the default value in the task outcome field. In this situation, the task outcome field still displays the default value on the workflow status page."
but no luck with this as well)

- Tried to make the schema of custom outcome column same with SharePoint default TaskOutcome having however still same issue

- Any many other options tried but no luck.

After a week's debugging finally found the trick to solve this product bug.

1. Create one global variable after the Assign task step.


2. Set the global variable value to task outcome column explicitly.


3. Mapped it with assigned task's TaskID variable.


4. we are good to go, now we get the task outcome as a result which we select in task form.

Happy coding!


Monday, May 13, 2013

Errors were found when compiling the workflow. The workflow files were saved but cannot run. - SharePoint 2013

Today while trying to publish the workflow, came across the weird error
"Errors were found when compiling the workflow. The workflow files were saved but cannot run."



After digging into it, came to the solution that need to  Re-register service into my site using following commands:


Register-SPWorkflowService -SPSite 'https://my-host/mysite' -WorkflowHostUri 'https://workflowhost' -AllowOAuthHttp -Force

I reopened SharePoint Designer again and problem disappeared.

Hope this will save your time.