How to redirect after login

I developed a new entrypoint (new php page), It receive some information from url parameter, process some logic, and then redirect to a especifc Account (depend on url parameter). It works fine if the user is loged in. But when the user is not loged in, the login screen show up, but after the user login the index page is shown. How to redirect to Account page after login ?

This is the code used to redirect to the Account:

SugarApplication::redirect(‘index.php?’ . http_build_query($params).’&return_module=Accounts&return_action=DetailView&offset=1’);

I would like, after login, that “redirect” be fired

You can change the default module after login by adding this to config_override.php:

 $sugar_config['default_module'] = 'Tasks';

Thanks to @urdhvatech BTW.

Thanks,

BrozTechnologies

Unfortunately is not my use case.

I dont want to redirect always. I will redirect only in some cases and for especific user.

I have to give more information.

The new entrypoint I have created become a link in other intranet site. So when the user click the link (in the other application), some process occurs (in the suitecrm), and then, the redirect is executed to open the Account detailview, in a especific record, the record is result of the logic process.

After login, the user should be redirect to a especific record. The “redirect” should be applied again.

I am considering pass user and password in header, then try to login in suitecrm, so the redirect will work always but i dont think its a good ideia

Using logic hooks could be a good option. The User Hooks specifically. Check documentation here:

Thanks,

BrozTechnologies

I solved the problem

I made a mistake protecting my entrypoint.

Now, after I corrected, even if the user is not logged. My code runs, and at the end, redirect to url like that “index.php?module=Accounts&action=DetailView&record=13890e3c-2b65-e7ef-1cda-5ee3eb373856”. Then, the user can login and after the suitecrm show the especific Account record, in detailview