API Integration Rule Logic Causing Entire Form to Hide

I have a button on a step that invokes an api integration call via a rule. Based upon the results I’d like to either go to the next step (Step 4) if the api call results in a 200 status code, go back to a previous page (called Treez in this example) if the status code is 401, and if it is anything else go to the last Step (Step 4).

const data = await feathery.http.connect(‘Create on Source System’);
console.log(data);
if (data.statusCode == 200) {
console.log("Status code " + data.statusCode );
results.value = “Success”;
feathery.goToStep(‘Confirmation Page’);

} else if (data.statusCode == 401){
console.log(“Credentials invalid”);
feathery.goToStep(‘Enter Credentials’);
}else {
console.log("Failed with status: " + data.statusCode + " " + data.data.message);
results.value = "Failed, check response: " + data.data.details;
feathery.goToStep(‘Confirmation Page’);

}

Generally this seems to work, but the form itself gets hidden (there is a console log message that states the form is hidden) after I click the button and I am not sure why. Do you see anything that would cause that or adjustments I should make to achieve the result mentioned above?

Hi there, I could think of a combination where your form might be coming to an exit point on that button and it might be set to hide form on completion. You could check your setting on this part

I tried setting complete submission to no and it still happened.

But the After Form Completion is still “Hide Form”?
You should avoid using the following on the button then:

The more appropriate action here would be “Custom Action” if you will be calling a logic rule and navigate with it.

Thanks! I had copied this form and didn’t catch that setting, solved my problem perfectly.