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
({ | |
/** | |
* Retrieve the data from server | |
* call prepareData function to filter out unnecessary data | |
* */ | |
onInit : function(component, event, helper) { | |
var action = component.get("c.getRecords"); | |
action.setStorable(); | |
action.setCallback(this,function(response) { | |
var state = response.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
/* | |
* This method will call the server side action and will execute callback method | |
* it will also show error if generated any | |
* @param method (required) - Server side methos name | |
* @param callback (required) - Callback function to be executed on server response | |
* @param params (optional) - parameter values to pass to server | |
* @param setStorable(optional) - if true, action response will be stored in cache | |
* */ | |
window.callServer = function(component, method, callback, params, setStorable) { | |
var action = component.get(method); |
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
<!--Exntends Base Component in Component Definition --> | |
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" controller="AccountController" access="global" > | |
<aura:attribute name="data" type="Account[]"/> | |
<!-- Including BaseJS script. Once loaded call fetchAccounts method --> | |
<ltng:require scripts="{!$Resource.BaseJS}" | |
afterScriptsLoaded="{!c.fetchAccounts}"/> | |
<aura:iteration items="{!v.data}" var="acc"> |
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
({ | |
fetchAccounts : function(component, event, helper) { | |
helper.getAllAccounts(component, helper); | |
}, | |
}) |
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
({ | |
getAllAccounts : function(component, helper) { | |
//Calling BaseJS method to call Aura Method | |
callServer(component, "c.getAccounts", | |
function(response){ | |
if(response){ | |
component.set("v.data", response); | |
//Calling showToast method of BaseJS | |
showToast({ | |
"title": "SUCCESS", |
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
/** | |
* BusinessDays Class | |
* Use this class to operate only on business days | |
* and easily skip weekends and holidays from your logic | |
* @author - Manish Choudhari | |
* */ | |
public class BusinessDays | |
{ | |
public BusinessHours bHours; | |
/** |
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
<!-- - **Generic Record Handler Component** | |
- Use this component to edit any record of any object on the same page | |
- The component gives you option to only view custom or standard objects or all objects | |
- You can view your record in read only mode or view mode | |
- @author - Manish Choudhari | |
- --> | |
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" | |
access="global" | |
controller="GenericRecordHandler"> | |
<!-- Init handler, this function will be executed on page load --> |
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
({ | |
/** | |
* This function will be called on page load | |
* This sets data table columns and also fetches object list | |
* @author - Manish Choudhari | |
* */ | |
doInit : function(component, event, helper) { | |
component.set('v.columns', [ | |
{label: 'Name', fieldName: 'Name', type: 'text'}, | |
{label: 'Action', type: 'button', initialWidth: 135, typeAttributes: |
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
({ | |
/** | |
* This function gets object list | |
* @author - Manish Choudhari | |
* */ | |
getObjectList : function(component) { | |
var action = component.get("c.getObjects"); | |
action.setCallback(this,function(response) { | |
var state = response.getState(); | |
if (state === "SUCCESS") { |
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
/** | |
* Controller class for GenericRecordHandler Lightning Component | |
* Contains method to retrieve objects and records | |
* @author - Manish Choudhari | |
* */ | |
public class GenericRecordHandler { | |
// This method retrieves all object list from Salesforce Org | |
// You can filter out object list here, as per you use case | |
@AuraEnabled(cacheable=true) |