How to add response code 200 condition in XOR gateway

hi all,
i am trying to send response entity from my java class ,and in the gateway condition i want to check if the status is 200 then move forward or else the token stays there only.
how can i use this in my XOR gateway condition?
example- i am trying to do ${status==200}
which is not working.
Any help is welcomed.

@Niall if you can help me on this.

I need a lot more information -
upload your model
show the code where you’re setting the status variable and maybe also explain a bit about what you mean by “not working”. :slight_smile:

change4.bpmn (9.2 KB)

Niall what i am trying to do is i have a java connector class where i am returning
return ResponseEntity.status(HttpStatus.ACCEPTED).body(status);
now what i want is only when my statusCode is 200 it should cross the Gateway or else it should go back to the “send task”.

Now when i am trying to create a new instance, it is throwing the following error in Postman
{

"type": "RestException",

"message": "Cannot instantiate process definition change4:1:f90af069-0a05-11eb-a393-8c1645ee0634: Unknown property used in expression: ${ResponseEntity.status(200)}. Cause: Cannot resolve identifier 'ResponseEntity'"

}

Thank in advance :slight_smile:

Any Suggestion @Niall ?

You should create a variable for the response code as part of the output of the connector, then the gateway will have access to it.

Understood thank you @Niall

And one more thing Niall if for the following flow

if i want to set the number of retries to be 3 max and if it exceed it should terminate the process,how do i set that boundry event?

@BerndRuecker @Niall any suggesstion pls?

You can set a variable on a listener at the beginning of the gateway and then add an additional clause to the gateway
e.g.
#{status == 200 && attempt < 4}

@Niall if there any way other than listener,i want it to be done from the camunda’s side only without the intervention of any java class.

The listener can be a script embedded in the model without requiring a Java Class.

hi niall,

as in the image above you can see as you told en the sequence flow just at the starting of the gateway i have included the following listener,
please check if this is the right way to do so,
i have a CONNECTOR in my Send Task which has output paramter as VALUE
and now i have implemeted the above ,
when the attempt becomes 0 the CONDITIONAL BOUNDARY event should hit and end the process,But still it is going into loop.
Can You please Help into this? :slight_smile:

The script you have there will reset the value to 4 each times it’s run.
You’ll need to check first if the value is null - only set it’s null you set it to 4 otherwise you decrement it.