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
LeonardLeonard 

Trigger on Note IF the note is on a custom object

I want to write a trigger on a Note that fires only if the Note is being created on a certain custom object. What's the best way to do that?

 

Is there a way to determine the type of object represented by the Note's OwnerId value?

_Prasu__Prasu_

Hello Leonard,

 

You can refer the ParentId field of the Note object. First 3 character of the ID represent to a specific object(which is known as ID prefix). so if case is that you want to check that Note is created for the Opportunity record, you can check if Parent id starts with the "006".

 

Regards,

Prasanna