sc_exit(sel) -> onAfterUpdate


sc_exit(sel); is not working on event onAfterUpdate. Gets stuck after the update button is clicked.

As far as i remember, this bug existed since v5 and still it hasn’t been fixed.


sc_exit(sel); is not working on event onAfterUpdate. Gets stuck after the update button is clicked.

As far as i remember, this bug existed since v5 and still it hasn’t been fixed.[/QUOTE]

I have found same issue. If you use sc_exit, the application will hang, but not only after update.


I have reported this issue to our bugs team for further testing.

Bernhard Bernsmann


Are you trying to close an application using sc_exit(sel), or are you trying to return to a previous application, closing the current one, using the macro?

Bernhard Bernsmann

It depends what you mean under application. I have a modal form showing a workflow rule and was trying to close when the user clicked one of the added buttons. Now they have to click a button, wait for the update and then have to click ‘exit’. But because of that they can click the same button again which causes a problem in the businessrules. If you have the sc_exit the application simply hangs with the scrolling busy icon.

Hello Mr. Drent,

By simply using sc_exit() without passing any parameter the application shouldn’t hang… It might be a case to get in touch with our support to find out why this is happening.

sc_exit(sel) is used when you are working on an application, for instance a Grid, and from that Grid you call a Form in a modal, and then according to your logic at some point the Form will be closed and the user will return to the Grid application.

Is that your case?

Bernhard Bernsmann

At least that is my case. I have a set of workflow rules, a user is picking one up and a decisionform appears as a modal form. Then the user need to accept, decline, whatever. This is put behind a button. If you push a button the rule should be processed and the user needs to return to the original app. As soon as you use sc_exit nothing works.

I think i have tried both, i.e. to exit from modal as well as “open in the same window” mode, and when sc_exit(sel) is called, to return to the original grid.

The thing is that it seems to work in other events (where this macro can be applied), but not in onAfterUpdate…


After re-reading the topic, I noticed that you are calling sc_exit(sel) from onAfterUpdate, and that is where the problem is. sc_exit() scope doesn’t cover onAfterUpdate().

Please see:

Bernhard Bernsmann


Anyway, how we’d use / in what case we’d need sc_exit() in onScriptInit.

By the way it works perfectly fine in onAfterDelete event. Would it be wiser to add it in onAfterUpdate?

Also according to the documentation, there is onClick() event in form application , i haven’t seen that event in Form application :slight_smile:


That is a button event being fired. I have contacted our development team to see if it is possible to add that macro to other events.

Bernhard Bernsmann

Ok. I was not certanly thinking of the button events when i wrote the message :stuck_out_tongue:

Anyway, it would be easier to do certain things in the form if this macro would be added to the other events.

Thanks Bernhard for your help,

Yes I missed that. Then the question should become: how can I close the modal form from a macro? In my case it’s just a button, but onafterupdate would be ok.

in my application a from is always called by a grid … in the grid I define that the form is automatically closed after update…
So I don’t need sc_exit(). I agree that it’s not logic not to alow sc_exit in OnAfterUpdate…


Well it’s worth a try. But I do the update in my own php event, not as a result of a ‘normal’ crud operation. So I don’t expect much. But I agree on the onafterupdate though.

It is possible to close the form automatically when the form is opened in Modal window, if it is opened in the same window, then there is no option to close it automatically.

Yes if you use the default save button. But not if you use a custom button with your own php. Then you need to be able to close the form manually. sc_exit does not work.

Exactly, if you have custom PHP button it won’t work, it would be good if it would work in the situations like these also.

Hello boys!!! Macro scope: [TABLE=“class: macros_desc_scope_table, cellpadding: 0, cellspacing: 0, width: 0”]
[TD=“width: 120px, bgcolor: #F7F4F4”]onScriptInit[/TD]
[TD=“width: 120px, bgcolor: #F7F4F4”]onClick
[TD=“width: 120px, bgcolor: #EFEDED”]onClick

Pls, this is a post over 4 years old!