The issue came when we migrated from 2007 to 2013. Tried all the possible option to fix the issue:
Application error when access /_layouts/15/Workflow.aspx, Error=Column 'MyColumnName' does not exist. It may have been deleted by another user. /MyListName at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException) at Microsoft.SharePoint.Workflow.SPWorkflow.GetIStatusAsText(Int32 iStatus) at Microsoft.SharePoint.Workflow.SPWorkflow.GetIStatusAsHtml(Int32 iStatus) at Microsoft.SharePoint.Workflow.SPWorkflow.GetIStatusAsHtml() at ASP._layouts_15_workflow_aspx.__Render__control15(HtmlTextWriter __w, Control parameterContainer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at Microsoft.SharePoint.WebControls.AjaxDelta.RenderChildren(HtmlTextWriter output) at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.AjaxDelta.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.SharePointForm.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.DeltaPage.RenderToBase(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.DeltaPage.Render(HtmlTextWriter writer) at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Designer Approach
-
http://www.mysharepointadventures.com/2011/07/sharepoint-2010-list-workflow-status-unexpected-error/
But we could not even open Workflow.aspx to manually start the workflow.
We removed all the workflows the library (Not from SharePoint Designer) but still the issue remains the same.
- https://social.technet.microsoft.com/Forums/sharepoint/en-US/352f885e-715c-4437-aff5-97c2fb29c18f/application-error-when-access-layouts15workflowaspx-errorcolumn-incoming-does-not-exist?forum=sharepointadmin
We could not use this approach as it was live site and InfoPath form library, which has its own issues.
Solution:
Manually Create the column:
We just cannot create this column via UI, it has to be via powershell or CSOM/REST.
We used the sp-pnp js https://github.com/SharePoint/PnP-JS-Core/wiki/Developer-Guide .
Steps:
This is special column basically the ‘Workflow Status’ type.
- To get it right we will use the Schema of existing workflow Column
To get the schema use;
$pnp.sp.web.getList("/MyListUrl").fields .get().then(function (result) { for(x=0;x<result.length;x++){ console.log(result[x]); } }).catch(function (error) { console.log(error); });Here you will see similar name column but with different number in the end like MyColumnName41.
You can copy the schema of existing column and make few tweaks.
-
<Field DisplayName="MyColumnName" Type="WorkflowStatus" Required="FALSE" ID="{678b3d73-9ccf-4e90-9e6b-132de914c53b}" SourceID="{4524b4c6-7c6a-4778-8d25-b5ac0e25271d}" StaticName="MyColumnName" Name="MyColumnName" ColName="MyColumnName123" RowOrdinal="0" Version="3" WorkflowStatusURL="_layouts/15/WrkStat.aspx" ReadOnly="FALSE"> <CHOICES> <CHOICE>Starting</CHOICE> <CHOICE>Failed on Start</CHOICE> <CHOICE>In Progress</CHOICE> <CHOICE>Error Occurred</CHOICE> <CHOICE>Canceled</CHOICE> <CHOICE>Completed</CHOICE> <CHOICE>Failed on Start (retrying)</CHOICE> <CHOICE>Error Occurred (retrying)</CHOICE> <CHOICE /><CHOICE /> <CHOICE /><CHOICE /> <CHOICE /><CHOICE /> <CHOICE /> <CHOICE>Stopped</CHOICE> </CHOICES> </Field>Here MyColumnName is the missing column or the name in the error message.
- Change the SourceID={“Guid of your List”}. This guid is of the list where workflow was attached.
-
Code to Add this Column:
var missingField = '<Field DisplayName="MyColumnName" Type="WorkflowStatus" Required="FALSE" ID="{678b3d73-9ccf-4e90-9e6b-132de914c53b}" SourceID="{4524b4c6-7c6a-4778-8d25-b5ac0e25271d}" StaticName=" MyColumnName " Name=" MyColumnName " ColName=" MyColumnName123" RowOrdinal="0" Version="3" WorkflowStatusURL="_layouts/15/WrkStat.aspx" ReadOnly="FALSE"><CHOICES><CHOICE>Starting</CHOICE><CHOICE>Failed on Start</CHOICE><CHOICE>In Progress</CHOICE><CHOICE>Error Occurred</CHOICE><CHOICE>Canceled</CHOICE><CHOICE>Completed</CHOICE><CHOICE>Failed on Start (retrying)</CHOICE><CHOICE>Error Occurred (retrying)</CHOICE><CHOICE /><CHOICE /><CHOICE /><CHOICE /><CHOICE /><CHOICE /><CHOICE /><CHOICE>Stopped</CHOICE></CHOICES></Field>'; $pnp.sp.web.getList("/MyListName").fields.createFieldAsXml(missingField).then(f => { console.log(f); }); -
Check if field is added correctly
$pnp.sp.web.getList("/MyListUrl").fields .get().then(function (result) { for(x=0;x > result.length;x++){ if(result[x].StaticName.indexOf("MyColumnName") > -1){ console.log(result[x]); } } }).catch(function (error) { console.log(error); }); - If all goes well, you can open the Workflow page.
Phewww…
