You need to sign in to do that
Don't have an account?
brahmanaidu
Creating a Record on clicking of a button in salesforce Lightning
public class CreateRecord
{
public static void createAccount(){
List<Account> accList=Trigger.new;
List<Account> accs=new List<Account>();
for(Account a:accList){
Account a1=new Account();
a.Name='mbnchowdary';
a.Site='mandalapu';
a.Email__c='mbnchowdarysfdc@gmail.com';
accs.add(a);
System.debug(accs);
}
insert accs;
}
}
<aura:component controller="RecordInsertion">
<ui:button label="click" aura:id="button" press="{!c.doPerform}"/>
</aura:component>
({
doPerform:function(component,event,helper){
console.log('method is called');
var action=component.get('c.createAccount');
action.setParams({
});
$A.enqueueAction(action)
}
})
{
public static void createAccount(){
List<Account> accList=Trigger.new;
List<Account> accs=new List<Account>();
for(Account a:accList){
Account a1=new Account();
a.Name='mbnchowdary';
a.Site='mandalapu';
a.Email__c='mbnchowdarysfdc@gmail.com';
accs.add(a);
System.debug(accs);
}
insert accs;
}
}
<aura:component controller="RecordInsertion">
<ui:button label="click" aura:id="button" press="{!c.doPerform}"/>
</aura:component>
({
doPerform:function(component,event,helper){
console.log('method is called');
var action=component.get('c.createAccount');
action.setParams({
});
$A.enqueueAction(action)
}
})
All Answers