Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<aura:component implements="force:appHostable" controller="myfirstltngController">
<aura:attribute name="account" type="Account"/>
<aura:handler name="init" action="{!c.init}" value="{!this}"/>
<button onclick="{!}">click</button>
public with sharing class myfirstltngController {
public static Account retrieveAccount() {
return [select Id, Name from Account limit 1];
public static void saveAccount(Account account) {
upsert account;
init : function(component, event, helper) {
var action = component.get('c.retrieveAccount');
action.setCallback(this, function(data) {
component.set('v.account', data.getReturnValue());
save: function(component, event, helper) {
component.set('v.account.Name', component.get('v.account.Name') + 'x')
var action = component.get('c.saveAccount');
action.setParams({account: component.get('v.account')});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.