3

So we've got the usual DML statements insert accts; and we've got the database class dml statements, e.g. Database.insert(accts, false). Had a team member ask me a question about the parameter definitions and when I looked for the documentation it seems to have completely disappeared. Anyone know where to find it? Any links to the old html documentation out there that still might have this?

Dug through the apex docs, developer force, and stack exchange. No dice, found an old link in this question, but now it's dead.

3

The documentation exists in the most literal interpretation of the "correct" location. The Database.insert method and friends are actually part of the Database class in the System namespace, and not a part of the Database namespace.

As such, the documentation is found at Reference > System Namespace > Database Class, or directly at https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm%23apex_System_Database_methods

  • 1
    i thought i was losing my mind, thanks @ca_peterson! – Ralph Callaway Jan 13 '16 at 21:49
3

Update

They do exist, just in a strange location. See @ca_peterson's answer below

Old Answer

For unknown reasons there isn't a place for the specific method documentation. However there are other places to look to get the details you need, primarily the slew of classes found under the Database Namespace, not the DML namespace.

For example from the SaveResult Example

It inserts two accounts using Database.insert with a false second parameter to allow partial processing of records on failure.

From historical knowledge, I know that's the opt_AllOrNone parameter, which also exists in with the DML Options class so you can use that to get an actual description. Bear in mind, the default is true when used with Database. unlike DMLOptions - exactly the reason why it would be good to have this sort of documentation (see this excellent blog post from Andres Perez for details on confirming this behavior)

optAllOrNone

Specifies whether the operation allows for partial success. Signature

public Boolean optAllOrNone {get; set;}

Property Value

Type: Boolean

Usage

If optAllOrNone is set to true, all changes are rolled back if any record causes errors. The default for this property is false and successfully processed records are committed while records with errors aren't.

This property is available in Apex saved against Salesforce API version 20.0 and later.

  • 1
    Great minds think alike. – sfdcfox Jan 8 '16 at 21:23
  • 3
    At times it seems like there's very little rhyme or reason as to how those classes are laid out in the documentation. One can easily miss some very important classes, or classes that should be located adjacent to one another because they're functionally equivalent or so closely related. These two would be good examples. – crmprogdev Jan 8 '16 at 21:28
  • Not to mention, every time they change their docs, the URL structure changes and they don't even bother to re-write URLS. Half my SF bookmarks are dead. You come across dead links constantly on SE and even more so on their own developer forums... – NSjonas Jan 8 '16 at 21:54
  • @crmprogdev yep, that's where i was looking, there isn't any documentation for the Database.<method> calls, in particular the method signature outside of the tangential documentation in the return types, e.g. Database.SaveResult, there used to be a page for this I swear that documented the actual method signature – Ralph Callaway Jan 11 '16 at 17:17
  • @crmprogdev you'll notice that they have some explanation buried in the example for save results that the second param when false allows for partial success. but was looking for specific documentation like they have for each of the attributes of the save result. seems like i didn't miss it, it just no longer has it's own section ... – Ralph Callaway Jan 11 '16 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.