Guest User

Untitled

a guest
Apr 25th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. ({
  2. createAccount : function(component, Account) {
  3. console.log('inside helper');
  4. var action = component.get("c.saveAccount");
  5. console.log('after method called ');
  6. action.setParams({
  7. "Account": Account
  8. });
  9. action.setCallback(this, function(response){
  10. var state = response.getState();
  11. if (component.isValid() && state === "SUCCESS") {
  12. var accounts = component.get("v.accounts");
  13. accounts.push(response.getReturnValue());
  14. component.set("v.accounts", accounts);
  15. }
  16. });
  17. $A.enqueueAction(action);
  18. },
  19.  
  20. public class NewAccountHandler {
  21. @AuraEnabled
  22. public static Account saveAccount(Account Account) {
  23. system.debug('***--' + Account);
  24. upsert Account;
  25. system.debug('***--1' + Account);
  26. return Account;
  27. }
Add Comment
Please, Sign In to add comment