Created
May 18, 2020 18:56
Star
You must be signed in to star a gist
Visualforce Controller - Good Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New account | |
Account a = new Account(Name = 'New Account'); | |
insert a; | |
// If DML failed, salesforce shows error and rolls-back the new record | |
// New Case linked to account | |
Case c = new Case(subject = 'I need help', accountId = a.id); | |
insert c; | |
// If DML failed, salesforce shows error and rolls-back the new record | |
// If we get this far in code, both DML's finished properly | |
system.debug('Success'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment