Find your content:

Search form

You are here

How to fetch namespace prefix and salesforce instance using javascript?

 
Share

i am using Custom button & links in List view of Object and on click of button i am executing javascript to redirected to new page and its works fine in my DE but when i install that package in sandbox it gives me visualforce error that page not found, i know that this is because use of Namespace prefix, because namespace prefix is not attached in newly created URL. i can find the way if i get the way of getting namespace and salesforce instance or should i use another way(i don't have second option as i am new to salesforce)


Attribution to: Axaykumar Varu

Possible Suggestion/Solution #1

I'm assuming the resolution of Namespace is a build time dependency rather than runtime, as it is unlikely to change dynamically. You can therefore add a static reference to the Package Namespace, rather than attempting to resolve at runtime.

Navigate to Setup > Installed Packages

Click on the Package you've installed and are referring to. You will be able to see the Namespace Prefix here. Use this when referencing the page.

So if the Namespace Prefix is PKG and the VF Page is called VFPage, the URL should be

/apex/PKG__VFPage

i.e. /apex/NameSpace__PageName


Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5082

My Block Status

My Block Content