Error in JSON trigger code when saving a workflow in the visual editor
Scenario
When saving a workflow in the visual editor (or the code editor), an error is displayed similar to the one below:
What’s happening?
This error means there are inconsistencies in the workflow status names. This usually happens when you add triggers to the workflow that reference an incorrect status name.
When you save the workflow with the new trigger, workflow builder validates the code for the workflow and checks for inconsistencies: state names; approval names
For example, the following trigger references the Draft state name in the trigger action.
the JSON code format is correct
A Wrong format error is displayed if there is a missing paired bracket or unrecognized character.
Apply is enabled
However, choosing to Save in the visual editor for a workflow with the states Review; Rejected; Approved
checks for inconsistencies between the trigger and the workflow
and displays the validation error as there is no Draft state in the workflow
Solution
To solve this, ensure the trigger references
the same status name
the same lettercase for the characters in the name (capital and lowercase letters)
Once the JSON trigger code is fixed, you can save the workflow.
See also