function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
textualtextual 

Using Schema Describe to get Objects ID for Attachment Transfer

I'd like to move attachments from one unsecure object to a new custom more secure object and was hoping to make this code a little dynamic by providing a list of objects I want to pull attachments from, like 
List<String> {'Opportunity', 'Contract', 'Thing__c'};

I'm looking to get the schema info for these Objects and then query the Attachments where ParentId contains the first three of the Object Id's, lke how all Accounts start with '001'
  1. Is this approach possible, to query Attachments using ParentId like '001'% ?
  2. How do I get the Id for objects, like 001 for Account?
ShashankShashank (Salesforce Developers) 
You can find the record id prefixes for standard objects here: https://help.salesforce.com/apex/HTViewSolution?urlname=Standard-Field-Record-ID-Prefix-Decoder&language=en_US