Updating variables for a Service task (REST API call)

Hi all,

I am creating a process that has two service tasks. The first one fetches the data needed for the second task (e.g. URL, method, and payload), and stores them in variables.

For example, the data fetched from the first service task, and assigned to variables to be used by the second one:
URL: “http://localhost:8080/UUID.php
Method: “POST”
Payload: “{ “customerName”: “${customerName}”}” (this payload has a variable inside, and it has to be updated from the variable I am passing when testing the process)

“customerName” : {“value” : “Ahmad”, “type”: “string”},
“businessKey” : “Testing”

In the second service task, I assigned the payload variable fetched from the first one to “payload” input parameter in the second one as ${payload}, and it works except that the passed variable inside the payload is not being updated (i.e. instead of passing “{ “customerName”: “Ahmad”}”, it passes “{ “customerName”: “${customerName}”}”).

If I assign { “customerName”: “${customerName}”} to “payload” input parameter in the second service task, that variable gets updated as expected!

How to resolve this issue? Any suggestions for this case?
I tried using an expression task in between, but still, that variable is getting passed as a string without being updated with the value needed.

P.S. The reason behind that is to make the second service task a dummy which can execute anything that comes to it without hardcoding the variable in the process I am creating.

Finally, I could resolve the problem I was facing! :slight_smile:

What I noticed is, I need to use S function(spin) provided by Camunda engine for my JSON input, convert it to a string, and then use JSON.parse after that with “FOR” loop to update the values of the JSON content I am fetching from the first service task.