none
Deleting orphaned workflow status columns

    Question

  • I have a SharePoint online list that has 8 orphaned workflow status columns, and this is preventing me from saving the list as a template. I believe I need to programmatically remove the orphaned columns, and need some advice on how to do that.

    Some background:

    The list was created from a template. The list uses a custom content type, and the content type has a workflow attached to it. I made various changes to the template by adding it as a list, making my changes, and then saving the updated list as a template with content. The list now has 8 workflow status columns. They are visible if you go to the list View settings. They are not shown on the list settings page where you can edit the other list columns. 

    Current error received when trying to save the list as a template: 

    Sorry, something went wrong. Read error on file "_catalogs/lt/Test1112.stp".

    

    In SharePoint Designer, the columns appear when I go to the List, click on Edit list columns, and choose 'Show Read-Only'.

    They cannot be deleted from the GUI or SharePoint Designer. I am a Farm Admin / Site Collection Admin and when I delete the columns in SPD it says 'Could not save the field changes to the server'. 

    I've tried using the script in this post:

    https://social.technet.microsoft.com/Forums/office/en-US/613a9a71-7a8e-4769-9fe6-cbb65ac06b4a/how-to-delete-orphaned-workflow-status-columns-from-sharepoint-list-views?forum=sharepointcustomizationprevious

    however it isn't a valid script for SharePoint Online; it worked in the 2010 version of SharePoint online apparently but not the current version. 

    How do I get rid of these orphaned workflow status columns??

    Wednesday, September 14, 2016 7:40 PM

All replies

  • Hi David,

    Have you try to delete the orphaned workflow instance from UI?

    Navigate to the list->workflow settings->choose the corresponding content type in the associations of the type->click Remove, Block, or Restore a workflow:

                                  

    You can remove the workflow from here:

    Best Regards,

    Lisa Chen


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, September 15, 2016 10:09 AM
    Moderator
  • Yes, I did remove them from there previously, but they still appear as read-only columns in the list of columns available to add to the view. 

    Here is all I see at the 'Remove, Block or Restore a Workflow' page...one newly created workflow, the one I do want running on this content type. 

    Thursday, September 15, 2016 2:06 PM
  • I replicated the issue in my development site in SharePoint Online:
    1. Create a list.
    2. Add content type with workflow to list.
    3. Save list as template.
    4. Deploy a new list from the new template.
    5. Repeat steps 3-4, six times. On the 7th time, you will get an error, and there will be a list of workflow status fields that cannot be removed, present on the list.
    Thursday, September 15, 2016 4:46 PM

  • Hi David,

    Take a look at the similar issue article:

    https://christopherclementen.wordpress.com/2014/02/13/read-error-on-file-when-saving-list-as-template/

    Best Regards,

    Lisa Chen


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, October 7, 2016 10:05 AM
    Moderator
  • Thanks, but that solution doesn't apply to SharePoint Online since you are not able to modify the list view lookup threshold.
    Tuesday, October 11, 2016 1:48 PM
  • I had the same problem recently with SharePoint Online. I was able to remove the columns by doing the following:

    Use the SharePoint Module for managing lists, items and files located here (Import-Module .\SPOModCURRENT20170918.psm1 -Verbose to import the module):

    https://gallery.technet.microsoft.com/office/SharePoint-Module-for-5ecbbcf0#content

     

    Get the information about the column with the below command:

     

    get-spolistcolumn -ListTitle "Controlled Documents" -FieldTitle "Job Title"

     

     

    CanBeDeleted         : True

    DefaultValue         :

    Description          :

    Direction            : none

    EnforceUniqueValues  : False

    EntityPropertyName   : JobTitle

    Filterable           : True

    FromBaseType         : False

    Group                : Custom Columns

    Hidden               : False

    ID                   : 8c2cb87d-bf75-4fa4-bf09-83aa328027a5

    Indexed              : False

    InternalName         : JobTitle

    JSLink               :

    ReadOnlyField        : True

    Required             : False

    SchemaXML            : <Field DisplayName="Job Title" Type="WorkflowStatus" Required="FALSE" ID="{8c2cb87d-bf75-4fa4-bf09-83aa328027a5}" SourceID="{e482e429-5400-4692-a324-6b0715f38cf8}"

                           StaticName="JobTitle" Name="JobTitle" ColName="nvarchar20" RowOrdinal="0" Version="3" WorkflowStatusURL="_layouts/15/WrkStat.aspx"

                           ReadOnly="TRUE"><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>Canceled</CHOICE><CHOICE>Approved</CHOICE><CHOICE>Rejected</CHOICE></CHOICES></Field>

    Scope                : /Safety/ControlledDocuments

    Sealed               : False

    StaticName           : JobTitle

    Sortable             : True

    Tag                  :

    Title                : Job Title

    FieldType            :

    TypeAsString         :

    TypeDisplayName      :

    TypeShortDescription :

    ValidationFormula    :

    ValidationMessage    :

     

     

    Set the column to read only = false.

     

    set-spolistcolumn -ListTitle "Controlled Documents" -FieldTitle "Job Title" -ReadOnlyField $false

     

    Remove the column.

     

    remove-spolistcolumn -ListTitle "Controlled Documents" -FieldTitle "Job Title"

    Wednesday, January 31, 2018 10:30 PM