How can I use http task respone status at next process node?


After http task execute, when http body return a string like ‘1’, I can use it to judge, but can’t use response status code to judge, how can I deal with it?


Docs say can directly use it.

Remember all the above execution variable names are prefixed by evaluated value of resultVariablePrefix. For example response status code can be accessed in another activity as task7.responseStatusCode. Here task7 is the id of the service task. To override this behavior, set resultVariablePrefix as required.

I have resolved it, at v6.1.2, there is is bug, can’t rightly get response result variables. I can get it after modify source code, then I noticed github code has been update, but not publish a version. github commit:

Use taskResponseStatusCode! No task.responseStatusCode!

1 Like

Hi, sorry to bother you, can you tell me how you get the result variable?
I’ve set the parameters as you in the image, but if I print the process variables the response variable name is not there (in your case is hrResponse). Do you have the code to do this? I’m stuck and can’t find any example. Thank you

Hey @infiniteloop,

You can read more about the Http Task result variables here in the Flowable documentation. By default the response parameters are not saved into variables. In order to do that you would need to set the saveResponseParameters flag to true. You can read more about the Http Task configuration here.


Hi @filiphr , I had a look at the docs but I can’t make it work. I do not have saveResponseParameters flag in the http task, I only have Save response status, headers that I’ve set to true. Only other flag I have for response is Save response as JSON . I’ve specified Response variable name, one time with $ prefix and one other without, but I can’t retrieve it. Where should I find this variable and how should it be retrieved?

@infiniteloop can you perhaps share your BPMN XML so we can have a look at it?

Are you talking now about the Flowable UI Modeler?

You need to specify the resultVariablePrefix. If you don’t then the id of the task would be used for the variables.

Thank you @filiphr . This is my BPMN XML:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="" xmlns:xsi="" xmlns:xsd="" xmlns:flowable="" xmlns:bpmndi="" xmlns:omgdc="" xmlns:omgdi="" typeLanguage="" expressionLanguage="" targetNamespace="">
  <process id="Login" name="Login" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <serviceTask id="LoginTask" flowable:type="http">
        <flowable:field name="requestMethod">
        <flowable:field name="requestUrl">
        <flowable:field name="requestBody">
          <flowable:string><![CDATA[{"email": "peter@klaven" , "password" : "cityslicka"}]]></flowable:string>
        <flowable:field name="responseVariableName">
        <flowable:field name="saveResponseParameters">
  <flowable:field name="resultVariablePrefix">

And yes, I’m talking about the UI Modeler since I create my XMLs there.
I’ve specified the resultVariablePrefix as “test”, anyway I’m missing how to retrieve this variable. I’ve tried to print process variables but it isn’t there, and I couldn’t find any example where the variable is retrieved

Ps the variable “status” where the result should be is now written like that, but it’s not the only way I’ve tried

Please read the HTTP Task documentation. All parameters are explained there in detail.

The responseVariableName would be the name of the variable where the result of the HTTP call would be stored. If you use ${status} then the expression would be resolved to fine the name of the variable. In your case you want to use status only.

The resultVariablePrefix is the prefix for the execution variable names. So in order to get the response status code you would use testResponseStatusCode (in your example).

As I said, I’ve tried also with different syntax for status, even just the name as you suggested, but the variable is not present in the process variables. I’m not printing that variable only, I’m printing the map of all the process variables, and I’m not finding any testReponseStatusCode or status code at all in the variables :\

Hi @filiphr,

I followed your advice, but it’s still null.

I attached the sreenshoot modeler:

I attached the screenshoot postman response:

The configuration below works properly:

Hey @budi,

I don’t see a difference between the configuration that works and the one that doesn’t for you

Hi @filiphr,

The difference I give a red box.

Thanks @budi,

I see it now. Yes you need to explicitly say that you want to store that