Redirect back to a certain record at some event in modal form

Hi:D

I am trying to make a single record form (A) with master/detail forms.
I need to create a custom button that open another application (B) in modal form, so that when I click one of the custom button at (B),
it will redirect the parent window back to the single record form (A) , but not at the default record 1, at some specific record instead.

Is there any good way to do it?:confused:

On the application (B) I created a button to set a session variable before redirecting back to single record form (A),
and at (A) I wrote something like this:
record_redir();

Where record_redir is a cutom function as follow:

if(isset($_SESSION[“rec”])){
$rec=$_SESSION[“rec”];
unset($_SESSION[“rec”]);
sc_ajax_javascript(“nm_navpage”,array($rec,‘P’));

}

Any idea why this doesn’t work?:frowning:

I’ve had some issues with accessing to $_SESSIONS in scriptcase. Try using the regular variables of scriptcase and setting them as “session” (left menu > Application > Global variable). Your code may be like this:

if(isset([rec])){
	$rec=[rec];
	sc_reset_global([rec]);
	sc_ajax_javascript("nm_navpage",array($rec,'P'));

}

I don’t know why, but it seems that when I try to run javascript, even simple ones like window.close(),
my application will display a blank page with “ok” button and then nothing happen. What is the problem here?:confused:

Add sc_exit(sel)

Buttons are running under other context. In 8.1 will be an Ajax button to do it in the sams