This file contains hidden or 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
({ | |
/** | |
* Call Apex Server-Side method in Promise | |
*/ | |
sendRequest : function(cmp, methodName, params){ | |
return new Promise($A.getCallback(function(resolve, reject) { | |
var action = cmp.get(methodName); | |
action.setParams(params); | |
action.setCallback(self, function(res) { | |
var state = res.getState(); |
This file contains hidden or 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
({ | |
'showAccount' : function(cmp, ev, helper) { | |
var params = { accountId : '001xxxxxxxxxxxx' }; // your parameters | |
helper.sendRequest(cmp, 'c.firstRequest', params) | |
.then($A.getCallback(function(records) { | |
console.log('First From Server-Side: ' + records); | |
return helper.sendRequest(cmp, 'c.secondRequest', params); | |
})) | |
.then($A.getCallback(function(records) { | |
console.log('Second From Server-Side: ' + records); |
This file contains hidden or 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
({ | |
'showAccount' : function(cmp, ev, helper) { | |
// First Request | |
var actionOne = cmp.get('c.firstRequest'); | |
actionOne.setParams({ accountId : '001xxxxxxxxxxxx' }); | |
actionOne.setCallback(this, function(res) { | |
var stateOne = res.getState(); | |
if(stateOne === 'SUCCESS') { | |
console.log('First From Server-Side: ' + res.getReturnValue()); | |
// Second Request |
This file contains hidden or 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
public with sharing class SampleAuraController { | |
@AuraEnabled | |
public static Account findAccounts(String accountId) { | |
List<Account> accounts = [SELECT Id, Name FROM Account WHERE Id = :accountId]; | |
if(accounts.isEmpty()) return null; | |
return accounts[0]; | |
} | |
} |
This file contains hidden or 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
({ | |
'showAccount' : function(cmp, ev, helper) { | |
var action = cmp.get('c.findAccount'); | |
action.setParams({ accountId : '001xxxxxxxxxxxx' }); // your parameters | |
action.setCallback(this, function(res) { | |
var state = res.getState(); | |
if(state === 'SUCCESS') { | |
console.log('From Server-Side: ' + res.getReturnValue()); | |
} | |
else if(state === 'ERROR') { |
This file contains hidden or 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
<aura:component controller="SampleAuraController"> | |
<lightning:button label="Call Server-Side" onclick="{!c.showAccount}"/> | |
</aura:component> |
This file contains hidden or 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
{ | |
"packageDirectories": [ | |
{ | |
"path": "force-app" | |
} | |
], | |
"namespace": "", | |
"sourceApiVersion": "39.0" | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<types> | |
<members>*</members> | |
<name>ApexClass</name> | |
</types> | |
<types> | |
<members>*</members> | |
<name>ApexComponent</name> | |
</types> |
This file contains hidden or 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
$ sfdx force:mdapi:deploy:report --jobid 0Af7F00000Osj2vSAB --targetusername [email protected] | |
Deployment finished in 1000ms | |
=== Result | |
Status: Succeeded | |
jobid: 0Af7F00000Osj2vSAB | |
Completed: 2017-10-24T14:37:42.000Z | |
Component errors: 0 | |
Components deployed: 3 |
This file contains hidden or 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
$ mkdir mdapi_output | |
$ sfdx force:source:convert -d mdapi_output/ --packagename package_name | |
$ sfdx force:mdapi:deploy -d mdapi_output/ -u "[email protected]" | |
3976 bytes written to /var/folders/hc/y4848ym172119ztcc4cyhx5r0000gn/T/mdapi_output.zip using 78.966ms | |
Deploying /var/folders/hc/y4848ym172119ztcc4cyhx5r0000gn/T/mdapi_output.zip... | |
=== Status | |
Status: InProgress | |
jobid: 0Af7F00000Osj2vSAB |
NewerOlder