Redirect to any DocType after Login


When I log in, I want it to redirect to the item page if he has the role of stock manager and to the lead page if he has the role of sales user. So is it possible that it can redirect to any page?

Thanks in advance

You can specify homepage for that particular Role.

It is not working so any other option.

Hi @Foram , you can do some hooks like this,

on_session_creation = [

then under your_py_file

def the_function_name():
        #check the role of the user and redirect where you want
        frappe.local.response["home_page"] = "page_link_where_you_want_to_redirect"


Is it possible to do this with client script/server script/website script because I do not have access to the backend code so?

I don’t think it’s possible. Only possibility is add Home Page in Role profile.

But it’s not working that is the only problem. If any other solution than do help us.