Im using responses from a google form to create a jira issue, i.e IT support tickets etc.
I want to implement conditional logic , i.e if option A is selected then pass the value of option A to http request.
I tried looking into switch nodes but when I using expressions in the http raw body it seems to be static and not dynamic as I thought. i,e when I load data using option b, option A is still in the raw body.
To use expressions you need to set them as âExpressionâ on the top right of the field.
Can you just directly pass in the value from the webhook to the http request?
If the value is the same thing then you can do that. It would be something like this.
If you need to change the value for the http request, for example if the input is b but you need to output 2, then there are a few options.
Code would probably be easiest for anyone comfortable with that.
You could also use a switch statement, but you will need to manually set the fields as switch statements, like if statements, donât change values just control the flow
If there are only two options, you could also use a ternary operator in the expression
{{ $json.option === 'a' ? '1' : '2' }}
With this code, if $json.option === 'a' is true, it will set the value to 1. Otherwise it will be 2
I hope this is helpful. If not please send a sample of the webhook body then i can help further
I would assume I could pass the value straight to http request raw body using expressions. I have tried expressions using {{$json.body[âwhat teamâ]}} into the json raw body.
However, when I test with option1 value and then test a submission with option2 its like option1 has been hardcoded into the json raw body that I wish to send.