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

Redirect from within Button in managed package not working

Okay.  I have a button on the contacts list view.  The user selects the contacts, clicks the button and a window is poped up so the user can may a choice.  User is redirected to one of three pages depending on the user's selection.  


This is part of a managed packaged.  It works perfectly in my development envrinment but not in other orgs. 


Problem:  I receive the following error message when trying to redirect:

Page NewVBCampaign does not exist


Here's the code:

window.location.href="/apex/NewVBCampaign?campaignType=" + campaignType + "&sourceType=contact&selectedItems="+idArray;


I tried using URLFOR with Page.NewVBCampaign but that does not even work in the development org. 


Thank you,



Best Answer chosen by Admin (Salesforce Developers) 
Imran MohammedImran Mohammed



You should append namespace to the visualforce page in the URL.

Try this and let me know if it worked.


window.location.href="/apex/<<Namespace>>__NewVBCampaign?campaignType=" + campaignType + "&sourceType=contact&selectedItems="+idArray;

For ex: if your namepsace is ABC_DEF, then the URL should be something like this

window.location.href="/apex/ABC_DEF__NewVBCampaign?campaignType=" + campaignType + "&sourceType=contact&selectedItems="+idArray;