Scheduled Workflow fails due to special characters in SmartObject definition
KB002903
PRODUCT
When a SmartObject definition contains unsupported special characters, a scheduled workflow may fail with a error similar to '"' is an unexpected token. The expected token is ';'. This error can occur for the following reasons:
- When scheduling a workflow through the management site, the site incorrectly decodes workflow xml fields when loading the workflow xml fields/reference fields on the New/Edit workflow schedule form, and the decoded values contain invalid characters
- When the workflow attempts to execute a Reference step (e.g. Create Reference) on a SmartObject when the SmartObject definition contains unsupported special characters
Recreation Steps
You can recreate this error as follows:
- Create a simple SmartObject with 2 properties:
- Name (Text)
- This & That (Multivalue)
- Create a new workflow
- Add a new 'Create Reference' step to the workflow, and select the SmartObject you created GetList method, using the ID property as Key
- Deploy the workflow
- Navigate to Management Site > Workflow Server > Schedules
- Add new Schedule for the workflow to Start
- When the workflow starts, it fails on the Create Reference Step
Workaround
To resolve the issue, you will need to edit the SmartObject to remove the unsupported special character ('&' in the recreation example above) from the SmartObject definition, and then recreate the reference that point to the SmartObject to use the new definition. Then create a new workflow schedule.
If you created a column in SharePoint with a unsupported special character (e.g. &), you will need to remove the special character from the column definition in SharePoint, then recreate the SmartObject for the list/library, then recreate the Create Reference steps in the workflow, and then create a new workflow schedule.