I want to send success and error responses based on a condition. For example, I took a variable called a using the variable section and I needed to return the success & failure responses.
If I am trying to add two FgResponseBody sections, I get an error saying it can't be used more than one time.
Also, using Error node Can I return custom json message??

When you are building API workflows in Flowgear, there is no need to have two
FgResponseBodyproperties on your output Variable bar. You need to make sure that the flow you are building always has one outcome (Success or failure).If for whatever reason you need to return Success and Failure in a
jsonresponse, I would suggest that you combine those responses into 1jsonbody which can be plugged into oneFgResponseBodyproperty on your output variable bar. Here is a simple example:On the Error node. This is just used to present a custom message on the node when it fires. So if you send data down a stream after an error is caught, this message will be presented on an error node that makes it easy to find in the Activity Logs. The
ErrorMessageproperty data type is text, but it will take ajsonmessage if it is passed in.Below is an example of how to combine your
jsonmessages into one. The first screenshot shows you a very simple json object with one field called message. This message indicates my success. Keep in mind that this message does not have to come from a formatter, but I am using it to illustrate a message being caught.Here I am doing the same thing, but it is a message for failure.
In the screenshot below this section, I used Flowgear variables in another Formatter. A variable in Flowgear is used like this:
{variable_name_here}. The variable name being used in your expression will need to be the same name as your property on the node. I then created another simplejsonbody to wrap the two messages into one body.The result of the above will look like this: