Record not updating/deleting when written redirect code on events


I am having a grid of table Customers. I have created a form for Adding, Editing or Deleting record from the grid.

Now, in the form I had a sc_redir(‘grid_Customers’); code in onAfterUpdate and onAfterDelete event to redirect to the grid after update and delete. But, when I put this code in the event, the record is not able to update or delete. It just redirects to grid without updating or deleting.

Is this a SC9 bug? As this is happening for other tables too. Please experts help me here. I need to deliver this project in a very short time.


Hi Lokesh

you have to do an sc_commit_trans() before redirect.
Is well documented in manuals.


Nobody facing this issue? I guess this is the most common practice.

just link your form via the links of your grid, in principle the grid is linked with the form on the same table, it is not necessary to redirect, more if you are connected in this way on the table , by modifying data in the field you modify the data of the table, if you work with a temporary field, then you write in on validate ({your fields} = {temporary field name}:wink:

Hello Nsch,
Thanks for the reply.

Apologies but I didn’t understand your method, please elaborate with example of Customers Table.

Actually, if i write the redirect code on events, it does redirect but the changes are not reflected (not even in table). If I remove the code, it does modifies or deletes the record but as there is no code, it doesn’t redirect to the grid.

I want the record to modify as well as redirect.

before you use sc_redir, use the macro sc_commit.

Hey Alvagar,
Thanks a ton, it works and I am so glad that I will be deploying this application sooner.

You must insert a commit ( sc_commit_trans() ) before sc_redir

Hi Giorgio

Apologies. I just missed your answer earlier. Just now noticed that you solved my problem way early. Thanks a ton.