Sc_exit doesn't work in onScriptInit

Hi I want my form to go back to Editing (Return after inserting) when in INSERT Mode

and I want my form to exit in UPDATE Mode (Exit Application)

To control this behavior I use a GLOBAL variable and test it’s value in onScriptInit, depending of it’s value I want to use sc_exit() to Exit the Application. The problem is that it’s crash there with the message Processing

// onScriptInit
if ([exit_form_on_save] == true) {
	[exit_form_on_save] = false;
	sc_exit();
}	

// onLoad
if ({ID} < 1) {
        // Insert
	[exit_form_on_save] = false;
} else {	
        // Update
	[exit_form_on_save] = true;
}	

Return after inserting is set to yes, everything else to no

You can control that using navegation in aplication section.

Sorry is in spanish, but this work perfectly for your needs.

Thank you, but I need to use Return After Inserting in INSERT Mode and Exit Application in UPDATE Mode.

I cannot select both at the same time because Exit Application override the Return After Inserting.

This is a strange behavior, can even be call a bug, but we have to live with it.

I think I will end up with two form, one for Insert and one for Update, unless sc_exit() is fix

Thank you