Mysql not saving when sc_exit() in onAfterUpdate

I need to return to the calling grid after updating in form. But when there is a sc_exit(); in onAfterUpdate not saving is done. I complains (data not saved) if I use the return button. When I remove the sc_exit() the update is saved on disk.

Is sc_exit onAfterUpdate not allowed?
What is needed to return to calling grid onAfterUpdate?

You need an sc_commit_trans() before sc_exit()

Thank you gbravi for the quick reply.
With the sc_commit_trans() the saving just hangs indefinitely! This does not seem to solve the problem.

The question remains unsolved.

Reading the manual sc_exit() can’t be used in OnAfterUpdate event. How about sc_redir ?

Another option is to define a custom button ( ajax ) with this code

?><script>
nm_atualiza('alterar');
</script>
<?php
sc_commit_trans();
sc_exit();

Hope this help

Last but more easy

There is an option in Application / Navigation to Exit application after processing the form.
Try this one with the standard udate button without any other code.

You may want to try:

sc_exit( c );

See manual for more options.