New answers tagged

2 votes

Cleaner way to filter specific object ids from List <String>?

In addition to the simplified type check that @Adrian Larson pointed out, you can also change: UseFulObject__c uo = (UseFulObject__c) s.getSObjectType().newSObject(s); uo.IsActive__c = false; ...
user avatar
  • 28.1k
4 votes
Accepted

Cleaner way to filter specific object ids from List <String>?

What you have already looks good. The only optimization I see is you can just compare the token directly, you don't need String.valueOf. if (Id.valueOf(s).getSObjectType() == UsefulObject__c....
user avatar
  • 144k

Top 50 recent answers are included