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
XactAndyXactAndy 

Adding notes and attachments via the API

Hi,

Is there any documentation on how to add notes to a custom object via
the API? I've had a look, but no luck.

Thanks,

Andy
SuperfellSuperfell
Note n = new Note();
n.setParentId("someId");
n.setTitle("my note");
n.setBody("hello world");
SaveResult sr = binding.insert(new SObject [] {n})[0];
assert(sr.isSuccess());
knicholsknichols
Would it be possible to add a pdf that was already created in this manner?  If so, do you have a code sample?
sdavidow9sdavidow9
Were you ever able to figure out how to add a file attachement through APEX (that does not come in as an email)?
knicholsknichols
Not through Apex, however I did write some Java code that reads in a PDF and sends it to SFDC.  Basically, you just read the bytes into a byte[] from the file and set that in the body of the Attachment.