Announcement

Collapse
No announcement yet.

Changing the default menu page shown after login based on condition using sc_redir

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing the default menu page shown after login based on condition using sc_redir

    /**
    * Conditional redirection
    */
    I have an application that calls a menu. I know there is a setting in the menu application to make tell SC what the default page at opening will be. However, I want this default page that will be informed when the menu application is called. I tried the following script in the onExecute event of the menu application but it doesn't work right. Also, I don't have any parameters to pass so I just left these generic ones in as I am not sure if it matters.

    The example: If a user logs in the sec_login application will set the global variable [usr_priv_admin]. If the var = 'Y' then I was the default page that will open below the menu to be "grid_ticket". Otherwise, I want the default page that will open below the menu to be "form_ticket". What am I doing wrong?


    // Redirection parameters
    $redir_app = 'grid_ticket'; // Application name
    $redir_test = [usr_priv_admin] == 'Y'; // Redirection test
    $redir_target = '_self'; // Target window (_blank, _self, _parent or modal)
    $redir_param = array( // Param list, add as many as needed
    'param_1' => 'value_1',
    'param_2' => 'value_2',
    );

    // Redirection
    if ($redir_test)
    {
    sc_redir($redir_app, $redir_param, $redir_target);
    }

  • #2
    Hello,

    For what I understood of your problem, you could use the following logic:

    if ([usr_priv_admin] == 'Y')
    {
    sc_redir(grid_ticket)
    }
    else if ([usr_priv_admin] == 'Y') // Or simply ELSE
    {
    sc_redir(form_ticket)
    }

    regards,
    Bernhard Bernsmann

    Comment

    Working...
    X