+ Start a Discussion

Page Layout Assignment based on Profiles

I have a scenario where I am using a VF page on Object and based on Profile I need to assign the page layout.
Profile one needs to see VF page
Rest all profiles can see standard layout

but particular profile(Profile one should not have object view at all but see the VF page )

Can some one please help on this
SonamSonam (Salesforce Developers) 
For the records/data to be visible to the user on the VF page, you need to give him the minimum of read access to the profile.

However, you can hide the tab of that object from the profile such that he is not able to access the object from the UI.. 
Consider you need to do this for edit page.

visualforce page
javascript code 
function checkProfile()
                //check if user is admin or not
                if({!userProfileName} == 'admin')
                  //redirect to standard page .You need to build url by passing id
                  //redirect to custom page

I took following code from http://salesforce.stackexchange.com/questions/29361/conditionally-rendering-visualforce-element-based-on-user-profile
public String userProfileName { get { return [ select Profile.Name from User where Id = :Userinfo.getUserId() ].Profile.Name; } }

Hope this helps.