You need to sign in to do that
Don't have an account?

How to get article type in apex?
hi,
I am retriving article type of a particular article using getGlobalDescribe and keyPrefix.
But is there any other way to get article type ?
Thanks,
Monali
You need to sign in to do that
Don't have an account?
hi,
I am retriving article type of a particular article using getGlobalDescribe and keyPrefix.
But is there any other way to get article type ?
Thanks,
Monali
Hi,
No, there is no other way to retrieve the article type.
MonaliD:
Any chance you could share your code for finding out ArticleType?
Thanks!
Hi StephenDavidson,
Here is code for getting article type.
Map<String, Schema.SObjectType> objectMap = Schema.getGlobalDescribe();
Map<String, String>keyPrefixMap = new Map<String, String>{};
Set<String> keyPrefixSet = objectMap.keySet();
for(String sObj : keyPrefixSet)
{
Schema.DescribeSObjectResult r = objectMap.get(sObj).getDescribe();
String tempName = r.getName(); //will store object name
String tempPrefix = r.getKeyPrefix(); //will store object prefix
keyPrefixMap.put(tempPrefix, tempName); //e.g map will contain ('001','Account') for account object
}
string articleId = '0039000000A6bUw';
String articleIdPrefix = articleId.subString(0,3);
String objectType = keyPrefixMap.get(articleIdPrefix);
Thank you kindly.
I also got the following from Francois to be used with spring 2012 release.