Sc_alert() prevents an sc_redir()

I’m not sure if this is a bug or I’m doing something wrong, but it seems that whenever I try to use an sc_alert() in the same event as an sc_redir() (e.g onAfterInsert) the sc_redir() fails. My code:

$params = array(
'title' => 'Record Added',
'type' => 'success',
'timer' => '2000',
'showConfirmButton' => false, 
'position' => 'top-end',
'toast' => true

sc_alert("Customer Linked", $params);

Anyone have any thoughts on this?

I have used this code previously on a Button in a Form… maybe it will work for you.

sc_ajax_message(“MESSAGE HERE”, “MESSAGE TITLE”, “modal=N&button=Y&button_label=Ok&redir=form_employees.php&redir_target=_blank”, “”, “”);

The key was to make it an AJAX button… not a PHP button.

1 Like

I confirm I have the same issue.
Bug ?

@nwdbs that certainly can work in some situations, but my use case doesn’t fit the suggestion. I’m of the opinion that this issue is a bug. Thanks nonetheless for the suggestion and I’ll keep it in mind for another day :blush:

I confirm. doesn’t work for me too.
i do the something as you… sc_redir(…) still do nothing.
onAfterInsert or onAfterUpdate or delete…

$reg_id = {reg_id};
$params = array(
‘title’ => ‘INFORMATION’,
‘type’ => ‘success’,
‘timer’ => ‘2000’,
‘showConfirmButton’ => false,
‘position’ => ‘center’,
‘toast’ => true
sc_alert(“Succes”, $params);
sc_redir(pdfRecu, PARAM_REG_ID=$reg_id, “_blank”);