public static Schema.SObjectType getSobjectTypeByPrefix( String SObjectPrefix ){ for( Schema.SObjectType ot : Schema.getGlobalDescribe().values() ){ String keyPrefix = (String)ot.getDescribe().getKeyPrefix(); if( keyPrefix != null && keyPrefix.equals( SObjectPrefix ) ){ return ot; } } return null; }
String sourceAPIName = getSobjectTypeByPrefix(sourceId.subString(0,3)).getDescribe().getName();