7

Example: I have created New Case visualforce page for external users. After they create a case using this New Case page and try to edit the case, it displays the standard page layout in edit view. I want to be able to override this standard layout page and render a page that is exactly like my New case page. I cant customize the case Edit button as this will enforce my visualforce page for all users. I only want to render my visualforce Edit page for external users. Thanks.

7

yes it is.

go to Case --> buttons, link, Actions then find the Label "edit" and select the action edit. .. then you can override the std page with that vf one.

Now, say if you want to choose between a std page and the vf page? What you'd do is create a routing VF page. So, when the user clicks edit, he goes to the router. based on what ever criteria (i.e. ecternal user / internal user), he'll get sent to where he needs to go.

Example

if you need any paramaters from your previous page, you can get those via a referring page. you can make this call in your constructor to build your retURL for a cancel action, or if you need the referrinf record in any way

 //vf page
apex:page action={!router}>

 // in  controller

public pagerefernce getRouter()
    PageReference p ;   
    if ($UserInfo.getProfileId == '') <-- external profile{
        p = new PageReference(/apex/YourVFPage);
        }else{
        p = new PageReference('/'+this.case.id+ '/e?nooveride=1'
        }
    return p;
}
  • Can you add how to route to the standard (layout-based) page? – Keith C Mar 14 '14 at 16:26
  • updated... that's the idea. – PartOfTheOhana Mar 14 '14 at 17:57
  • 1
    ... in my experience you also need nooverride=1 to avoid just ending up in an infinite loop. Or am I missing something here? – Keith C Mar 14 '14 at 18:02
  • you're right, he's need that for the std page redirect. i thinks? I updated the code.. – PartOfTheOhana Mar 15 '14 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.