1

I have a custom VisualForce page for Viewing items in a particular Object, I would like however the view to be only be shown for Portal users, for all other users it should display the normal SF pages.

I have found a solution already but it feels quite 'hackish' because when non portal users view it they are shown the development page for the visual page very breifly before being redirected to the normal SF view page. This is the code if it makes more sense:

<apex:page standardController="News__c" action="{!if($Profile.Name =='Customer Portal', null,
        urlFor($Action.News__c.View, News__c.Id, null, true))}">

1 Answer 1

0

That code is the correct way of doing things. The users shouldn't see the contents of the VF page when using an action attribute on the apex:page component, as per the docs:

This method will be called before the page is rendered and allows you to optionally redirect the user to another page.

They will see a request/response cycle as you need your VF page to be loaded in order to make the decision whether to stay on it or not, but none of the body of the page should be loaded.

There's really no other way to achieve this - you can't intercept the request server side and take any action as Salesforce doesn't provide that type of functionality.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .