Displaying details on FORM using the values from JSON response (obtained from Http Connector)


I am hitting the Url and then getting a JSON Response…Now I want to Use Values from that JSON response and display in the form.

But in the Tasklist I am getting below error:
**An error happend while submitting the task form : **
Cannot submit task form e974bf48-92bf-11e6-99c6-d43d7ec7ada1: Unable to evaluate script: sun.org.mozilla.javascript.internal.EcmaError: SyntaxError: Empty JSON string (#1) in at line number 1

Consider Below as the JSON Response:
“recordSetTotal”: “1”,
“resourceName”: “productview”,
“recordSetComplete”: “true”,
“recordSetStartNumber”: “0”,

How to resolve this??


Just use “response”. You don’t need the connector.getvar stuff.

Also look at using camundas spin framework to parse your string to a Json variable.

I tried with

but was getting the same error.:confused:

Just do response;in your script and open cockpit and inspect the process instance. Show me a pic of the data being stored as a string. It sounds like you are not getting your rest response back from your API call

Hi Stephen,

Today I am not able to move from the 1st activity(Provide Product ID), after submitting in the Tasklist it says:
**An error happend while submitting the task form : **
Internal Server Error
I am not able to hit the http URL from the Service Task after entering the ProductID (the URL is correct and its giving proper response when tried in Web Browser).

Not able to find the reason. Please help


@Tushar take a look through this post:

Follow through and use the example BPMN file. There are also some updates further down in the thread so make those changes to the BPMN file. Replace the sample URL in the BPMN file with your URL. If it does not work then you have a issue with your URL. The example in the post works and has worked for multiple people with similar issues as you described.
Likely you have a config issue in your BPMN.

Hi Stephen,

The “productId” variable i am entering in the first User Activity …I want to append that to my http URL…as it as a part of that URL only…

what is the format of appending that

How should i write it?



See docs on camunda variables.

I tried that earlier …its giving illegal characters error in the tasklist.

Try just using JS as a Script:

var productId = execution.getvariable("productID");
var url = "http://google.com/" + productId + "/xyz";

I tried this code in appendID.js file
var productid = execution.getVariable(“productId”);
var url = “http://abc/”+productid+ “?responseFormat=json”;
execution.setVariable(“url”, url);

and in Name= url
Type = Script
Script Format = “JavaScript”
Script Type = “External Resource”
Resource =“appendID.js”

ERROR: An error happend while submitting the task form :
HTCL-02005 Request url required.

@Tushar can you provide a copy of your BPMN and form you are trying to execute? It can be a simplified version.

CollectCatalogInfo.bpmn (9.6 KB)

I am not using any external form…its just 1 form field.

@Tushar add .value() to the end of your Scripts in the Output Parameters:




Yeah…Added …

But what about that appending “productId” with the Url “http://abc.com/def/{{productId}}/xyz”

how to do that?

Do a inline script rather than using a external resource

Can u tell what to write in the inline script…?

Can u tell what to write in the inline script…?

@Tushar you are writing the same thing that you put in the external file:

@Tushar take a look at: https://medium.com/@stephenrussett/deploying-external-scripts-with-camunda-rest-api-e06bd90a2931#.v0cq1m5lx for examples of how to access the deployed script if you want to use external script.

@StephenOTT tried the inline script also…still getting error…
An error happend while submitting the task form :
HTCL-02005 Request url required.

@Tushar sorry, I forgot a line.

Add return url; as the 3rd / last line of that script.