Skip to content

Instantly share code, notes, and snippets.

View Sunil02kumar's full-sized avatar

Sunil Kumar Sunil02kumar

View GitHub Profile
@Sunil02kumar
Sunil02kumar / SK_AuraComponentAttributeApp.app
Last active October 30, 2018 15:04
Aura.Component[] : Lightning Framework Specific Attributes Type
<aura:application extends="force:slds">
<c:SK_AuraComponentAttributeUsageCmp/>
</aura:application>
@Sunil02kumar
Sunil02kumar / gist:5406ae2db9e536ea9407886667142236
Created October 27, 2018 08:54
retrieve all recordtype information for account object
Map<string,Schema.RecordTypeInfo> ss= Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName();
system.debug('****ss:'+ss);
for(string rt:ss.keyset()){
Schema.RecordTypeInfo rtpeInfo=ss.get(rt);
system.debug('****getDeveloperName:'+rtpeInfo.getDeveloperName());
system.debug('****getName:'+rtpeInfo.getName());
system.debug('****getRecordTypeId:'+rtpeInfo.getRecordTypeId());
system.debug('****isActive:'+rtpeInfo.isActive());
system.debug('****isAvailable :'+rtpeInfo.isAvailable());
system.debug('****isDefaultRecordTypeMapping :'+rtpeInfo.isDefaultRecordTypeMapping());
<aura:application extends="force:slds">
<!-- extends "force:slds" interface so that SLDS will be imported in lightning component-->
<c:SK_LightningBasicsSSC/>
</aura:application>
@Sunil02kumar
Sunil02kumar / SK_Timmer.cmp
Last active January 13, 2020 06:57
Lightning Component For Timer
<aura:component >
<aura:handler name="init" value="{! this }" action="{!c.doInit}"/>
<aura:attribute name="ltngHour" type="Integer" default="00" />
<aura:attribute name="ltngMinute" type="Integer" default="00"/>
<aura:attribute name="ltngSecond" type="Integer" default="00"/>
<aura:attribute name="ltngTimmer" type="Integer" default="00:00:00" />
<aura:attribute name="ltngIsDisplayed" type="boolean" default="false"/>
<div class="slds-card slds-align_absolute-center" style="width:250px;padding:8px;" >
@Sunil02kumar
Sunil02kumar / SK_StopWatch.cmp
Created September 14, 2018 17:01
Lightning Component for Stopwatch
<aura:component >
<aura:handler name="init" value="{! this }" action="{!c.doInit}"/>
<aura:attribute name="ltngCurrTime" type="String" default="00:00:00"/>
<aura:attribute name="ltngIsDisplayed" type="boolean" default="false"/>
<div class="slds-card slds-align_absolute-center" style="width:250px;padding:8px;" >
<div class="slds-grid slds-wrap" >
<div class="slds-col slds-size_1-of-1 slds-align_absolute-center" >
<b>Stopwatch</b>
</div>
@Sunil02kumar
Sunil02kumar / SK_URLParamCmp.cmp
Created September 3, 2018 17:31
lightning:isUrlAddressable Interface: Way to get URL parameters in Lightning Components
<aura:component implements="lightning:isUrlAddressable,force:appHostable" access="global">
<aura:attribute name="urlParam" type="string"/>
<div class="slds-card">
If you implements "lightning:isUrlAddressable" interface, then by
using v.pageReference,you can get URL params.
<div class="slds-box">
Account name from URL parameter: <b>{!v.pageReference.state.accname}</b>
</div>
</div>
</aura:component>
@Sunil02kumar
Sunil02kumar / SK_ScheduleJobUtility.cls
Last active December 28, 2023 06:33
Way to get list of Scheduled reports and Jobs from Salesforce using apex
public class SK_ScheduleJobUtility{
public static void findScheduledJobDetails(string jobType){
string jobTypeNumber=jobTypeMap.get(jobType);
if(jobTypeNumber!=null && jobTypeNumber!=''){
List<CronTrigger> cjList=new List<CronTrigger>();
Set<string> userIdSet = new Set<string>();
for(CronTrigger cj :[select id, CronJobDetailId,CronJobDetail.Name,CronJobDetail.JobType, ownerId from CronTrigger where CronJobDetail.JobType=:jobTypeNumber]){
cjList.add(cj);
userIdSet.add(cj.ownerId);
}
@Sunil02kumar
Sunil02kumar / Demo_CreateDynamicCmp.cmp
Last active August 20, 2018 14:32
Creating Lightning Component Dynamically
<aura:component controller="Demo_CreateDynamicCmpController">
<aura:attribute name="ltngAccList" type="List"/>
<aura:attribute name="menu" type="List" default="View,Edit"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<div class="slds-grid slds-wrap">
<div class="slds-col slds-size_1-of-1 slds-small-size_1-of-2 slds-medium-size_2-of-4">
<lightning:card footer="@sunil02kumar" title="Recient Accounts">
<aura:set attribute="actions">
@Sunil02kumar
Sunil02kumar / SK_ApplicationEventPracticeApp.app
Last active August 19, 2018 01:22
Application Events : Way to Communicate Between Different Lightning Components
<aura:application extends="force:slds">
<c:SK_FirstComponent/>
<c:SK_SecondComponent/>
</aura:application>
@Sunil02kumar
Sunil02kumar / SK_ChildCmp.cmp
Created August 12, 2018 09:34
Component Events: Way to Communicate Between Components in Containment Hierarchy
<aura:component >
<aura:attribute name="childValue" type="string" default="Child"/>
<aura:registerEvent name="changeValueEvent" type="c:SK_LightningEventChannel"/>
<lightning:button name="ddff" label="Fire event" onclick="{!c.fireEvent}"/>
</aura:component>