Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var action = component.get("c.retrieveSObject");
- var fieldsSOQL = "Id, Name";
- var objAPIName = "Contact"
- var whereSOQL = "Birthdate = TODAY";
- var retrievedContactList = [];
- action.setParams({
- "fieldsToRetrieve" : fieldsSOQL,
- "objectToReturn" : objAPIName,
- "whereClause" : whereSOQL
- });
- action.setCallback(this, function(response) {
- var state = response.getState();
- if (state === "SUCCESS") {
- var returnVal = response.getReturnValue();
- if (returnVal) {
- retrievedContactList = JSON.parse(returnVal);
- //if you have a List attribute, you can set it here
- component.set("v.retrievedContactList", retrievedContactList);
- }
- } else {
- var errors = response.getError();
- console.error('error: ' + errors[0].message);
- }
- });
- $A.enqueueAction(action);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement