1

We are releasing application through salesforce. The product contains two part, one is a salesforce application distributed in a managed package. The other part is a mobile piece using salesforce sdk with REST API.

Since releasing from managed package, salesforce append unique 'Namespace' to the package, I am just wondering what is the common practice to deal with 'Namespace' on a salesforce client application? In our case, is how to deal with namespace on our mobile application?

Since the namespace is one per package, is hardcoding in the namespace of the product in the client application a good idea?

Does salesforcemobilesdk provide any library that can be used to retrieve namespace easily?

1 Answer 1

1

Sdk doesn't have library for that but you can get namespace of organisation but by query namespaceprefix from ApexClass object. And SDK have facility of query. There may other objects which can provide namespace but I prefer to use ApexClass.

In apexcode:

ApexClass ac = [SELECT NameSpacePrefix 
                FROM ApexClass
                WHERE Name = 'YourPackageClassName'];

In hybrid app query can be:

forcetkClient.query("SELECT NameSpacePrefix  FROM ApexClass WHERE Name = 'YourPackageClassName'", onSuccessFnc, onErrorFnc);
1
  • Thank you for the response! I am currently doing this in my project. I am just curious how other people doing this. Do you alway dynamically retrieve the namespace from salesforce?
    – bluecat
    Sep 5, 2013 at 19:13

You must log in to answer this question.

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