sc_exit(); doesn’t work in Form application onScriptInit, application crash
Dear @jlboutin60,
We verified that the sc_exit() macro is functional in the onScriptInit event. However, I believe that when inserted within the context you are intending, it is causing the error.
In what context is its application found? Is the problem only when saving the form, where should it go to another application or something similar?
There is an option in “Application → Navigation” called “Exit application”. We identified a problem with it and have already reported it for correction. We are also investigating in which events the macro is approved to be used, because when using it in the Form’s onScriptInit event, according to the functioning of this event, the macro is executed before we even see the application running.
We await your feedback regarding the questions asked at the beginning, and we will also bring you news as soon as we have any updates.
Best regards!
Some of the information on the form need the record ID to work correctly (Master/Detail). This information is not available when creating a new Entry.
So Application → Navigation → Exit application is OFF and Application → Navigation → Return after inserting is set to ON
When a new form is created it come back to the form and the information that is ID dependent can now be filled (Master / Detail). When we save this new information (UPDATE mode) it will come back to the form but I need it to Exit application instead.
I cannot set Application → Navigation → Exit application to ON because Application → Navigation → Return after inserting will not work anymore.
So I use a global variable to save the current mode (INSERT OR UPDATE) and in onScriptInit I want to use sc_exit() if the current mode was UPDATE and do nothing if it was INSERT
I hope that this information is clear enough
Workaround idea: When they click Add New, have it create a new record and carry the LastInsertId as var to the form. Then have the form always in Update mode.
Yes, but if they change mind I will end-up with unused ID and I will need to delete empty entries. I do not permit them to delete anything, just put them inactive.
It will be so much easier if the Application → Navigation → Exit application option would not override the Application → Navigation → Return after inserting
Or fix sc_exit()
Dear @jlboutin60,
The problem with the “Exit application” option was fixed and released in version 9.10.015 which is now available for download/update.
Regarding the option “Exit the application” replacing “Return after inclusion”, this no longer occurs
Best regards!