Skip to content

Instantly share code, notes, and snippets.

View choudharymanish8585's full-sized avatar
💭
Never Settle

Manish Choudhari choudharymanish8585

💭
Never Settle
View GitHub Profile
public class AccountController {
@AuraEnabled
public static List<Account> getAccountsWithOffset(String pageSize, String pageNumber){
Integer ps = Integer.valueOf(pageSize);
Integer pn = Integer.valueOf(pageNumber)-1;
List<Account> accounts = [SELECT
Id, Name, Phone, Rating, My_Custom_Field__c, Active__c
FROM Account LIMIT :Integer.valueOf(ps) OFFSET :(ps*pn)];
return accounts;
({
getAccounts : function(component, helper) {
var action = component.get("c.getAccountsWithOffset");
action.setStorable();
var pageSize = component.get("v.pageSize").toString();
var pageNumber = component.get("v.pageNumber").toString();
action.setParams({
'pageSize' : pageSize,
'pageNumber' : pageNumber
({
/*
* This finction defined column header
* and calls getAccounts helper method for column data
* editable:'true' will make the column editable
* */
doInit : function(component, event, helper) {
component.set('v.columns', [
{label: 'Name', fieldName: 'Name', type: 'text',
actions:[
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
access="global"
controller="AccountController">
<aura:attribute name="data" type="Object"/>
<aura:attribute name="columns" type="List"/>
<aura:attribute name="recordId" type="String"/>
<aura:attribute name="pageNumber" type="Integer" default="1"/>
<aura:attribute name="pageSize" type="Integer" default="10"/>
public class RecordChangeCaptureLightningController {
@AuraEnabled
public static String getUserName(Id userId){
User u = [SELECT Name FROM User WHERE Id=:userId];
return u.Name;
}
}
{
"data":{
"event":{
"createdDate":"2018-10-18T01:17:26.855Z",
"replayId":61,
"type":"updated"
},
"sobject":{
"Type":"Customer - Channel",
"Phone":"(785) 241-6201",
<!-- Show auto refresh selection in app builder page -->
<design:component>
<design:attribute name="autoRefresh" label="Auto refresh the page?" datasource="Yes,No" default="Yes" />
</design:component>
({
/*
* This method will call the server side action to get user name
* Once user name retrieved, it will show a warning toast to the user
* */
getUser : function(component, userId, eventType, entityName) {
var action = component.get("c.getUserName");
action.setParams({
"userId" : userId
({
checkCompatibility : function(component, event, helper){
//get current object
var objectName = component.get("v.sObjectName");
//Check is object name is not undefined/null
if(objectName){
//Get channel name for change event
var channelName = helper.getChannelName(objectName);
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName"
access="global"
controller="RecordChangeCaptureLightningController">
<aura:attribute name="channelName" type="String" default="" />
<aura:attribute name="autoRefresh" type="String" default="Yes" />
<aura:attribute name="isSupported" type="Boolean" default="false" />
<!--Loading list of supported object for change events
- This can be configured in a custom setting or custom metadata type also