Invalid field name {17ca3a22-fdfe-46eb-99b5-9646baed3f16}

Not the most descriptive title but basically summarises the issue. A customer contacted me as they had issues with an Approval Workflow, basically the Workflow would execute but it would never add anything to the Tasks list. The only information present in the ULS logs was:

Invalid field name. {17ca3a22-fdfe-46eb-99b5-9646baed3f16}

I did some investigation and found that this GUID relates to the FormURN field that should be present in the Tasks list - thanks Bing! My next course of action was to check the fields available in the Tasks list and compare these to a working Tasks list in a different Site Collection, I used the following PowerShell commands to collect this information. Where RootWebURL equals the URL of the Site Collection, for example

$Web = Get-SPWeb "RootWebURL"
$List = $Web.Lists["Name of Tasks List"]
$List.Fields | Select Title,InternalName | Sort InternalName > C:\Output.txt

From this output I could see that several fields were missing from the Tasks list (including FormURN).

I then compared the Task Content Type (which is automatically associated with the Tasks list) with a different Site Collection to identify any discrepancies using the following PowerShell commands:

$Web = Get-SPWeb "RootWebURL"
$Task = $Web.AvailableContentTypes | Where {$_.Name -eq "Task"} > C:\Output.txt

Interestingly I could see from the output that the content type had no fields associated with it (output cropped for brevity), this should have a number of fields associated.

My next step was to check the Site Columns to ensure that they were all available and present (in particular FormURN), again comparing with a "working" Site Collection using the following PowerShell commands:

$Web = Get-SPWeb "RootWebURL"
$Fields = $Web.AvailableFields | Select InternalName > C:\Output.txt

This identified a large number of Site Columns that were missing from the Site - including FormURN. Fortunately the fix was pretty simply, there is a Feature imaginatively named "Fields" that is responsible for creating a number of Site Columns, in this case it was simply a matter of disabling and then re-enabling this feature using the following PowerShell commands:

Disable-SPFeature –identity "Fields" -URL RootWebURL
Enable-SPFeature –identity "Fields" -URL RootWebURL

This successfully re-created all of the missing Site Columns and upon creating a new Workflow and associated Task list everything worked!

I would always advise thoroughly testing the final two commands on a copy of the Site Collection in a testing environment - you don't want to make things any worse :)

Brendan Griffin