Skip to content

Instantly share code, notes, and snippets.

@dancinllama
Created February 12, 2013 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dancinllama/4772135 to your computer and use it in GitHub Desktop.
Save dancinllama/4772135 to your computer and use it in GitHub Desktop.
Method for retrieving managed package prefix
/**
* @description determines the namespace prefix of the managed package
*/
public static String getNamespacePrefix(DescribeFieldResult fr){
String prefix = null;
String fieldName = fr.getName();
String localname = fr.getLocalName();
Integer idx = fieldName.indexOf(localname);
if(idx > 0){
prefix = fieldName.substring(0,idx);
}
return prefix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment