4

I have a managed/packaged visual force page DetailPage and I want a custom button on MasterPage to open it with parameters (the Id of the master record).

What doesn't work:

  1. Creating a CustomButton to link to a VF Page (from the dropdown list): The list only offers pages which extend my Master__c object
  2. Using a URL formula like /apex/DetailPage?master={!mypack_Master__c.Id}: the relative URL doesn't work once deployed because the packaged app runs on a different host!

I know I can make a VF page which redirects but this seems like overkill:

  1. Is there no way to know the full URL of a packaged page?
  2. Why is {!URLFOR($Page.CommentAdd, null)} not possible?

UPDATE:

  1. {!URLFOR($Page.mypack.DetailPage, null)} doesn't work
  2. {!URLFOR($Page.mypack_DetailPage, null)} doesn't work
  3. $Action applies only to standard objects apparently!
1
  • 3
    Interesting! There's no support for $Page in formula fields :( one can fully qualify the namespace and pass in parameters: {!URLFOR('/apex/ns__detailPage', null, ['foo'='bar','herp'='derp'])} but you say the packaged app runs on a different host... even with $Page how would one do that? Commented Mar 19, 2013 at 14:07

1 Answer 1

4

Even though the managed VF page runs on a different domain, e.g. namespace.na12.visual.force.com, prepending <namespace>__ to your page names will automatically send the user to this domain, no matter which domain the user started on. So, the correct way to do this:

/apex/namespace__DetailPage?master={!mypack_Master__c.Id}:  

where namespace is the namespace that the DetailPage VF page is included in. Really, this will work, from any client org. Example flow:

  1. CLient is on a record's detail page in subdomain/host na12.salesforce.com
  2. Client clicks Custom Button on that detail page, whose URL is /apex/namespace__DetailPage?master=<recordId>
  3. The client will be redirected to https://namespace.na12.visual.force.com/apex/DetailPage?id=<recordId>
2
  • Awesome thanks! How did you know that??
    – Marc
    Commented Mar 19, 2013 at 16:12
  • Experience :) Have to do it a lot.
    – zachelrath
    Commented Mar 19, 2013 at 20:54

You must log in to answer this question.

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