public static Boolean isIdsObjectTypeEqualToStringObjectType( String objectIdString,
String objectTypeNameString ){
Boolean isEqual = false;
if( Id.valueOf( objectIdString ).getSObjectType().getDescribe().getName().equals( objectTypeNameString ) ){
// getSObjectType().getDescribe().getName() gives us String that we can compare to incoming object type.
isEqual = true;
}
return isEqual;
}
Test class will be the same.
Enjoy.
No comments:
Post a Comment