+ Start a Discussion
rhsumnerrhsumner 

Determine Parent Type on Note

Hello, I hope someone can help me, I have the following function:

 

public static void CreateNote(Id parentId, string subject, string msg){ Note n = new Note(); n.Body = msg; n.ParentId = parentId; n.Title = subject; insert n; }

 

 Now, I need to update the parent records last modified timestamp, but in order to query the parent I need to determine the parents sObjectType from the parentId.

 

I have no idea how to do this.

 

 

ron_reedron_reed

You'll have to check and see what the first 3 digits of the ID are.  You can hover any of your tabs and look at the bottom status bar (or simply click on the tab and view the url) to determine what the first 3 digits are for that particular object. 

 

It will look something like this-

http://na4.salesforce.com/001/o

where 001 is the ID of that object

 

Here are some standard object IDs

 

001 = Account

00Q = Lead

003 = Contact

006 = Opportunity

800 = Contracts

500 = Cases

501 = Solutions

701 = Campaigns

 

Hope that helps