Guest User

Untitled

a guest
Jan 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. ({
  2.  
  3. changeNameToSusie: function(cmp, event, helper) {
  4. console.log("LDSErrorTest.handleRecordUpdated: entered");
  5.  
  6. var contact = cmp.get("v.contactRecord");
  7. console.dir(contact);
  8. contact.FirstName = "Susie";
  9. cmp.set("v.contactRecord", contact);
  10.  
  11. cmp.find("recordLoader").saveRecord($A.getCallback(function(saveResult) {
  12. if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
  13. console.log("# Success" + cmp.find("recordLoader"));
  14. cmp.find("recordLoader").reloadRecord();
  15. }
  16. else if (saveResult.state === "INCOMPLETE") {
  17. console.log("User is offline, device doesn't support drafts.");
  18. }
  19. else if (saveResult.state === "ERROR") {
  20. console.log('Problem saving record recordLoader, error: ' +
  21. JSON.stringify(saveResult.error));
  22. cmp.set("v.returnedError", JSON.stringify(saveResult.error));
  23. }
  24. else {
  25. // this will fail with a message of My_Test_Formula__c: Unable to create/update fields: My_Test_Formula__c.
  26. //Please check the security settings of this field and verify that it is
  27. //read/write for your profile or permission set
  28. console.log('Unknown problem, state: ' + saveResult.state +
  29. ', error: ' + JSON.stringify(saveResult.error));
  30.  
  31. cmp.set("v.returnedError", JSON.stringify(saveResult.error));
  32. }
  33. }));
  34.  
  35. console.log("LDSErrorTest.handleRecordUpdated: exit");
  36. },
  37. })
Add Comment
Please, Sign In to add comment