Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danieljpeter/2714615d16259736a05dd98987d13177 to your computer and use it in GitHub Desktop.
Save danieljpeter/2714615d16259736a05dd98987d13177 to your computer and use it in GitHub Desktop.
GET NAMESPACE IN APEX
public class ChrisNamespace {
public static final String ns = Namespace;
public static final String nsUU = NamespaceUU;
public static String Namespace {
get {
if (Namespace != null) return Namespace;
ApexClass ac = [SELECT NameSpacePrefix FROM ApexClass WHERE Name = 'ChrisNamespace' limit 1];
Namespace = ac.NameSpacePrefix != null ? ac.NameSpacePrefix : '';
return Namespace;
}
private set;
}
public static String NamespaceUU { get {return Namespace != '' ? Namespace + '__' : '' ;} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment