Skip to main content

Hi All,

 

I need to create a json payload inside a workflow to send to an external Rest API.

I used the org.camunda.spin.Spin.JSON   according to the camunda documentation.

Below is my script

var SpinJSON = org.camunda.spin.Spin.JSON;
var jsonObject = SpinJSON("{}");
var customerId = execution.getVariable("CustomerId");
var eventType = execution.getVariable("ifsBpaProjectionOperation");
jsonObject.prop("CustomerId", customerId);
jsonObject.prop("event_type", eventType);
execution.setVariable("varJsonBody", jsonObject.toString());

In the Debug mode, everything looks fine

Trigger for this is an event and we are trying to sync customer records with a 3rd party system

 

But in the execution, it gives an unexpected server eror

 

Looks like it Spin.Json prop() doesn’t work. Is this a bug?

 

IFS version: 24.1.3

 

Hi,

From workflow perspective it looks like spin is working as expected. since the json variable is created properly. 

Can you give bit more detail on what you are trying to do ? if the external system call happening inside the workflow as an IFS REST task or how are you using the json variable (varJsonBody) to set it to the external Rest API call?


Reply