Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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!
share|improve this question
2  
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? –  user320 Mar 19 '13 at 14:07

1 Answer 1

up vote 2 down vote accepted

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>
share|improve this answer
    
Awesome thanks! How did you know that?? –  Marc Mar 19 '13 at 16:12
    
Experience :) Have to do it a lot. –  zachelrath Mar 19 '13 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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