Created
November 13, 2018 11:34
-
-
Save simpluslabs/0cb4f0ea3b9225a87f3dcf87778c5501 to your computer and use it in GitHub Desktop.
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
({ | |
handleRecordUpdated1: function(component, event, helper) { | |
var eventParams = event.getParams(); | |
if(eventParams.changeType === "LOADED") { | |
// record is loaded (render other component which needs record data value) | |
console.log("Record is loaded successfully."); | |
} else if(eventParams.changeType === "CHANGED") { | |
// get the fields that changed for this record | |
var changedFields = eventParams.changedFields; | |
console.log('Fields that are changed: ' + JSON.stringify(changedFields)); | |
} else if(eventParams.changeType === "REMOVED") { | |
// record is deleted | |
} else if(eventParams.changeType === "ERROR") { | |
// there’s an error while loading, saving, or deleting the record | |
} | |
}, | |
handleSaveRecord: function(component, event, helper) { | |
component.find("recordSaver").saveRecord($A.getCallback(function(saveResult) { | |
if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") { | |
} else if (saveResult.state === "INCOMPLETE") { | |
console.log("User is offline, device doesn't support drafts."); | |
} else if (saveResult.state === "ERROR") { | |
console.log('Problem saving record, error: ' + JSON.stringify(saveResult.error)); | |
} else { | |
console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error)); | |
} | |
})); | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment