Easy ways to get the ID associated with a particular record for Inserts/Updates or Where clauses
IDs, not the associated names, are needed for certain fields when inserting or updating records to maintain foreign key relationships.
You may also need the ID when searching for certain records. For example, when assigning an owner to records to be inserted/updated you need the ID of the Owner NOT the owner name or alias; when adding campaign members to an existing campaign the Contact ID is needed; or changing record types the record type ID is required.
There are various ways to get IDs:
- If you only need to look up a few ID’s just go to Salesforce, select the record or link to the record (i.e. owner name, parent account) and grab the ID from the URL: https://na1.salesforce.com/0013000000Iemv1 (0013000000Iemv1 is the ID)
- NOTE: You cannot click on the record type field in a record and show the record type id in the URL. To find the record type ID either export the record type table using MassEffect (see #2 below), or go to Setup -> Customize -> {table} -> Record Types, click on the record type you want, and then select the record type id from the URL.
- To keep a handy cross-reference table of IDs, use MassEffect to export a particular table and store it on your PC. This is commonly done for the user table.