Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6936065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:11:09+00:00 2026-05-27T12:11:09+00:00

I have a Visualforce page using a custom controller that is used to edit

  • 0

I have a Visualforce page using a custom controller that is used to edit multiple records under an opportunity.

I’d like to create a custom button or link from Opportunities to this Visualforce page.

Currently the link looks like:

/apex/ExamplePage?oppId={!Opportunity.Id}

This works fine in the development sandbox, but when it is deployed as part of a managed package the link breaks as the page reference doesn’t have the namespace prefix.

I found the post Managed Package Redirecting Problem on the Force.com Discussion Boards which implied it should be possible to use $Page to reference the Visualforce page in the URL. E.g.

{!URLFOR($Page.MyExamplePage,'',[objectId = campaign.id])}

But doing so only gives me the syntax error:

Error: Field $Page.MyExamplePage does not exist. Check spelling.

There is another part to the post that suggests using an Apex class and Execute Javascript to work around it. But it appears to me that this has just moved the namespace issue into the Javascript.

How can I safely reference the Visualforce page to work both inside and outside a managed package?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:11:09+00:00Added an answer on May 27, 2026 at 12:11 pm

    Best to do this from an Apex PageReference return value. Something like this will work:

    public PageReference returnPage()
    {
       return Page.MyExamplePage;
    }
    

    Then call this from Visualforce:

    <apex:commandButton value="Go To New Page" action="{!returnPage}"/>
    

    The Apex Page call will handle the translation for you.

    [EDIT]

    Create a bare bones Visualforce page like this:

    <apex:page standardController="Opportunity" extensions="TheController" action="{!returnPage}"/>
    

    Add the above returnPage() method to a new TheController (or whatever) class. It doesn’t even need a constructor. The class can look like this:

    public TheController
    {
       public PageReference returnPage()
       {
          return Page.MyExamplePage;
       }
    }
    

    Then from the Opportunity settings page go to Buttons and Links and create a new custom Visualforce button selecting the new page you just created.

    That should do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom visualforce page. Here in the controller class i want
I have created a custom visualforce page. Here in the controller class i allow
What I'm looking to do is create a custom controller list that displays a
I have a custom portal integrated with a custom site, using Apex/Visualforce. I want
I'm generating a pdf using a VisualForce page with the renderAs param set to
Have started playing with Xcode 4.2, and created a single page application using storyboard
I have a custom object with a master-detail to opportunity. Is there a way
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.