Guest User

Untitled

a guest
Dec 11th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. handleSaveContact: function(component, event, helper) {
  2. component.find("contactRecordCreator").saveRecord(function(saveResult) {
  3. if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
  4.  
  5. // Success! Prepare a toast UI message
  6. var resultsToast = $A.get("e.force:showToast");
  7. resultsToast.setParams({
  8. "title": "Contact Saved",
  9. "message": "The new contact was created."
  10. });
  11.  
  12. // Update the UI: close panel, show toast, refresh account page
  13. $A.get("e.force:closeQuickAction").fire();
  14. resultsToast.fire();
  15.  
  16. // Reload the view so components not using force:recordData
  17. // are updated
  18. $A.get("e.force:refreshView").fire();
  19. }
  20. else if (saveResult.state === "INCOMPLETE") {
  21. console.log("User is offline, device doesn't support drafts.");
  22. }
  23. else if (saveResult.state === "ERROR") {
  24. console.log('Problem saving contact, error: ' +
  25. JSON.stringify(saveResult.error));
  26. }
  27. else {
  28. console.log('Unknown problem, state: ' + saveResult.state +
  29. ', error: ' + JSON.stringify(saveResult.error));
  30. }
  31. );
  32. },
  33.  
  34. handleCancel: function(component, event, helper) {
  35. $A.get("e.force:closeQuickAction").fire();
  36. }
Add Comment
Please, Sign In to add comment