Created
August 26, 2016 14:29
-
-
Save tommyilpazzo/c21964aa5b803070cd175d7a9bea1408 to your computer and use it in GitHub Desktop.
SFDC: Lightning JS function to save object into salesforce
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
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