Skip to content

Building a JSON payload in a workflow script task using Camunda's `org.camunda.spin.Spin.JSON` and its `.prop()` method works fine when stepping through in Debug mode, but throws an unexpected server error at actual runtime.

Answer

This has been traced to the runtime value of certain built-in workflow variables (like ifsBpaProjectionOperation) not being a plain JavaScript string type compatible with Spin's prop() function, even though it may display like a normal string value in Debug mode — explicitly coercing the value with String(...) before passing it to .prop() (for example, jsonObject.prop("event_type", String(eventType))) resolves the incompatibility and lets the JSON payload build correctly at runtime.

← Browse Workflows and automation questions