Skip to content

Instantly share code, notes, and snippets.

@maujood
Last active February 25, 2019 18:47
Show Gist options
  • Save maujood/00bbc07566755c1b5a1569e7321dd036 to your computer and use it in GitHub Desktop.
Save maujood/00bbc07566755c1b5a1569e7321dd036 to your computer and use it in GitHub Desktop.
Using the ApexHelper component
//You can use these utility methods by extending from the ApexHelper component created earlier:
//<aura:component extends="c:ApexHelper">
//Example of executing an Apex Method through our new utility:
helper.apex(component, "search", { searchstr : searchTerm })
.then(function (result) {
//do something with the result
})
.catch(function (error) {
//do something about the error
})
//Example of executing SOQL with our new utility
helper.soql(component, "SELECT Id, Name, AnnualRevenue, Industry FROM Account WHERE Name LIKE '%" + searchTerm + "%'")
.then(function (accounts) {
//do something about the accounts
})
.catch(function (error) {
//do something about the error
})
//Remember to use `this` instead of `helper` if you're using the utility methods inside a helper method.
@maujood
Copy link
Author

maujood commented Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment