function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NarenKNarenK 

Changing default landing tab based on user profile

Hi All,

 

When an end user access an application by default user will be landed to specified tab based on application configuration.

 

How can we change this behaviour? Based on user profile can we change this behavious (changin apex contollers /visualforce pages code)?

 

Pleas let me know.

 

Thanks in advance for your help!

 

Regards,

Naren

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can't get at the profile name that easily in Apex.  You have to use UserInfo.getProfileId() to get the id, and then query back the name via a SOQL call.

All Answers

bob_buzzardbob_buzzard

One way I think you could do this is to have a default landing tab that is a visualforce page, and this page would then send the user to a page specific to their profile.  I'd have thought you could do this via an action attribute on the page.

NarenKNarenK

Ok. But how can I get current user profile in visualforce page? Is there a way for it?

 

Regards,

Naren

bob_buzzardbob_buzzard

You can use the following:

 

$Profile.Name

 

NarenKNarenK

Using {!$Profile.Name} in Visualsoruce page working perfectly. But I want to get the profileName in apex class. How it is possible?

 

Regards,

Naren

bob_buzzardbob_buzzard

You can't get at the profile name that easily in Apex.  You have to use UserInfo.getProfileId() to get the id, and then query back the name via a SOQL call.

This was selected as the best answer
NarenKNarenK

Thank you.

Swamy P R NSwamy P R N
Hello bob, Naren
In my Organization we have different profiles, We need the Default application to be common for all the profiles but default landing tab to be different for all the profiles. For ex:
Sales users Profile--> "Quota is the default tab
Forecast users-->  "Quota" is the default tab
System Admin-->"Performance Report" is the default tab
For all those common application is "Sales"

I know you guys did samething depends on your business scenario with apex but i need to have it for object level. Please suggest me.