Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String getResponse() {
- System.debug('I am in!');
- if(validate()) {
- Visitor newVisitor = new Visitor();
- newVisitor.Name = 'John Smith';
- newVisitor.Identifier = 'john@somewhere.com';
- insert newVisitor;
- return '{"success":"true"}';
- }
- return '{"success":"false"}';
- }
- Visitor__c newVisitor = new Visitor__c ();
- newVisitor.Name = 'John Smith';
- newVisitor.Identifier__c = 'john@somewhere.com';
- insert newVisitor;
- try
- {
- insert newVisitor;
- }
- catch( DmlException ex )
- {
- // fail gracefully
- }
- try
- {
- Database.SaveResult[] MySaveResult = Database.Insert(newVisitors, false);
- }
- catch( DmlException ex )
- {
- // fail gracefully
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement