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
amorganamorgan 

How can I check if my page is in a managed package?

I need a good way to know if I'm in a managed package with a namespace or not.
If I use sforce.connection.query(soql) the query string will be different depending if the page is managed or not.

Example, if I'm in a managed packaged the query string would be
soql = "select myNamespace__myCustomField__c from myNamespace__myCustobObj__c"

but, when I deploy to another server my code becomes unmanaged and the query string needs to be:
soql = "select myCustomField__c from myCustobObj__c"

So, what's a good way to know if the code is managed or not so I can use the correct query string?
Best Answer chosen by Admin (Salesforce Developers) 
gv007gv007

One thing i would like tell you

 

Name Space is Organization specific and unique to that application and unique in force.com application data based.

 

if you are maintaing unmanaged code i belive accourding too documentation it wo't requries name space.

 

 

you can find out you appplication having namespace or not  using following things

 

1.Salesforce.com server URL  eg.https:\\namspace.na2.salesforce.com

 

2.checking the components

 

etc.

 

 

 

All Answers

gv007gv007

One thing i would like tell you

 

Name Space is Organization specific and unique to that application and unique in force.com application data based.

 

if you are maintaing unmanaged code i belive accourding too documentation it wo't requries name space.

 

 

you can find out you appplication having namespace or not  using following things

 

1.Salesforce.com server URL  eg.https:\\namspace.na2.salesforce.com

 

2.checking the components

 

etc.

 

 

 

This was selected as the best answer
amorganamorgan

gv007 wrote:

2.checking the components

 




Would you explain #2 please?
gv007gv007

components means custom object ,custom objects fields and VF page.

R u packaging yours application or not.If so it is managed or unmanaged.

amorganamorgan

gv007 wrote:

components means custom object ,custom objects fields and VF page.

R u packaging yours application or not.If so it is managed or unmanaged.




Both. It's managed when it's packaged and unmanaged when it's deployed to a server.
amorganamorgan
Method #1 works for me.