Skip to content

Instantly share code, notes, and snippets.

View victorabraham's full-sized avatar
💭
...

Victor Abraham victorabraham

💭
...
  • United States
View GitHub Profile
<aura:component implements="flexipage:availableForAllPageTypes" controller="ContinuationDemo">
<aura:handler name="init" value="{!this}" action="{!c.handleInit}" />
<aura:attribute name="blogs" type="List" default="[]" />
<aura:iteration items="{!v.blogs}" var="blog">
<lightning:card title="{!blog.title}">
<p class="slds-p-horizontal_small">
<a href="{!blog.url}" target="_blank">{!blog.title}</a>
</p>
</lightning:card>
</aura:iteration>
public with sharing class ContinuationDemo {
@AuraEnabled(continuation=true cacheable=true)
public static Object startContinuationRequest() {
Integer timeout = 50;
Continuation con = new Continuation(timeout);
//Apex method to execute after getting response
con.continuationMethod='processBlogResponse';
//State can be a variable of any type supported in apex
con.state='Additional variable to give context. If more than one use list/set/map';
//Create Http Request
curl https://salesforcecodestest-dev-ed.my.salesforce.com/services/data/v48.0/query?q=SELECT+Id,+Name+FROM+Account+LIMIT+1 \
-H 'Authorization: OAuth SessionIdHere' \
-H 'X-PrettyPrint:1'
#Use below API call to make SOAP login call. It will return a session token
curl --location --request POST 'https://login.salesforce.com/services/Soap/u/49.0' \
--header 'SOAPAction: login' \
--header 'Content-Type: text/xml' \
--header 'charset: UTF-8' \
--data-raw '<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<!--starting template-->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>AccountController</members>
<name>ApexClass</name>
</types>
<version>45.0</version>
</Package>
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>AccountController</members>
<name>ApexClass</name>
</types>
<!--Visualforce sample-->
<types>
<members>AccountPage</members>
.container {
background-color: white;
padding:40px;
}
.red-border {
border: 3px solid blue;
padding: 50px;
width: 320px;
height: 250px;
}
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<aura:attribute name="lastMessage" type="string"/>
<lightning:messageChannel type="CarSelectionChannel__c" aura:id="carChannel" onMessage="{!c.handleCarSelectionMessage}"/>
<lightning:card >
<div class="red-border">
<h1 class="slds-text-heading_medium">Aura</h1>
<br/>
<p>Please select your car:</p>
<input type="radio" id="audi" name="car" value="Audi" onclick="{!c.publishEventInMessageChannel}"/>
<label for="audi">Audi</label><br/>
<apex:page>
<style>
.green-border {
background-color: white;
border: 3px solid green;
padding: 50px;
width: 250px;
height: 250px;
float:left;
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>CarSelectionChannel</masterLabel>
<isExposed>true</isExposed>
<description>This Lightning Message Channel is used to notify when new cars are selected.</description>
<lightningMessageFields>
<fieldName>carName</fieldName>
<description>This is the name of the newly selected car</description>
</lightningMessageFields>
</LightningMessageChannel>