Skip to content

Instantly share code, notes, and snippets.

@tommyilpazzo
Created August 26, 2016 14:29
Show Gist options
  • Save tommyilpazzo/c21964aa5b803070cd175d7a9bea1408 to your computer and use it in GitHub Desktop.
Save tommyilpazzo/c21964aa5b803070cd175d7a9bea1408 to your computer and use it in GitHub Desktop.
SFDC: Lightning JS function to save object into salesforce
createObject: function(component, object) {
var action = component.get("c.saveObject");
action.setParams({
"object": object
});
action.setCallback(this, function(response){
var state = response.getState();
if (component.isValid() && state === "SUCCESS") {
var objects = component.get("v.objects");
objects.push(response.getReturnValue());
component.set("v.objects", objects);
}
});
$A.enqueueAction(action);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment