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
ethanoneethanone 

Redirecting to standard or VP page based on user profile

I'm trying to use a VF page for some users and not for others.  In fact, I've got 2 pages I'm doing this for: an edit page and a view page.  I'm using a fairly simple action call to make this happen, but it only works on one of the pages.

 

<apex:page action="{!if($Profile.Name = 'Sales',null,urlFor($Action.Case.View, $ObjectType.Case, null, true))}"

 I've overridden the New and the Edit buttons with my edit page, and I've overriden the View button with my view page.

 

If the user is in the Sales profile everything works great.  If they are not in the Sales profile and they click the New button, it redirects to the standard New page -except the "Cancel" button won't work (it just comes back to the same Edit page) and the URL is a disaster (cs3.salesforce.com/500/e?retURL=https%3A%2F%2Fc.cs3.visual.force.com%2Fapex%2FAgentRequestEditPage%3FretURL%3D%252F500%252Fo%26save_new%3D1%26sfdc.override%3D1&nooverride=1)

 

If a non-Sales user tries to click on a record to view the detail, I can see they are getting redirected, but they end up at a "URL No Longer Exists" page.  Likewise, that URL is also a disaster (cs3.salesforce.com/500/d?retURL=https%3A%2F%2Fc.cs3.visual.force.com%2Fapex%2FAgentRequestViewPage%3Fid%3D500Q0000002kXar%26sfdc.override%3D1&nooverride=1)

 

Can someone help me with:

A) why the View page says the URL doesn't exist and

B) Why the standard page cancel button won't work after being redirected to the new page.

 

Thanks.

 

 

Pradeep_NavatarPradeep_Navatar

Tryout the syntax given below. This syntax will work for your first query.

 

action="{!if($Profile.Name = 'Volunteer',null,URLFOR($Action.Case.Edit, $ObjectType.Case,null,true))}"

 

Hope this helps.

rmarma

I know this is an old thread. I am getting exact same error when I tried to overirde detail page of a custom object. 

Were you able to fix this?