Skip to content

Instantly share code, notes, and snippets.

View arun12209's full-sized avatar
🥑

Arun Kumar arun12209

🥑
View GitHub Profile
@arun12209
arun12209 / searchmetadata
Created December 22, 2018 08:09
SearchMetadata Lightning Component
<aura:component controller="searchMetadataCntrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="Result" type="Object"/>
<aura:attribute name="metadataType" type="string[]"/>
<aura:attribute name="selectedMetadata" type="string"/>
<aura:attribute name="searchKeyword" type="string"/>
<aura:attribute name="unFilteredResult" type="object"/>
<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
<aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>
<aura:attribute name="Spinner" type="boolean" default="false"/>
@arun12209
arun12209 / searchmetadataJS
Created December 22, 2018 08:14
searchmetadataJS
({
doInit : function(component, event, helper) {
var type=['ApexClass & ApexTrigger','ValidationRule','WorkflowRule','VisualforcePages','Static Resource','Email Template','Documents','Visualforce Component'];
component.set("v.metadataType",type);
component.set("v.selectedMetadata",'ApexClass & ApexTrigger');
helper.GetSearchedData(component,event,helper);
},
OnSelectChange:function(component,event,helper){
var selected=event.getSource().get("v.value");
console.log('selectted: ' +selected);
@arun12209
arun12209 / searchmetadataHelper
Created December 22, 2018 08:17
searchmetadataHelper
({
GetSearchedData : function(component,event,helper) {
var action=component.get("c.GetMetaData");
var selectedType=component.get("v.selectedMetadata");
action.setParams({
"type": component.get("v.selectedMetadata")
});
action.setCallback(this,function(response){
var state=response.getState();
if(state=='SUCCESS'){
@arun12209
arun12209 / searchmetadataCss
Created December 22, 2018 08:19
searchmetadataCss
.THIS .changeMe{
display: "";
color:red;
background-color:yellow;
}
.THIS .ul_list{
padding:10px;
}
.THIS .slds-page-header {
border-radius: 0px;
@arun12209
arun12209 / UtilsClass
Created December 22, 2018 08:23
UtilsClass
global class UtilsClass {
global static String getSessionIdFromVFPage(PageReference visualforcePage){
String content = visualforcePage.getContent().toString();
Integer s = content.indexOf('Start_Of_Session_Id') + 'Start_Of_Session_Id'.length(),
e = content.indexOf('End_Of_Session_Id');
system.debug('Session ID: ' + content.substring(s, e));
return content.substring(s, e);
}
}
@arun12209
arun12209 / SessionIdPage
Created December 22, 2018 08:24
SessionIdPage
<apex:page >
Start_Of_Session_Id{!$Api.Session_ID}End_Of_Session_Id
</apex:page>
@arun12209
arun12209 / searchMetadataCntrl
Last active December 22, 2018 08:59
searchMetadataCntrl
/* Name: ToolingCntrl
* Description: This Apex class makes callout to Salesforce Tooling Api and get the metadata information about the objects.
* Created By: Arun Kumar
*/
public class searchMetadataCntrl {
@AuraEnabled
public static string GetMetaData(string type){
HttpRequest req = new HttpRequest();
@arun12209
arun12209 / ContractPDF
Created December 30, 2018 07:59
ContractPDFCntrl
<apex:page controller="ContractPDFCntrl" sidebar="false" showHeader="false" applyBodyTag="false" renderAs="PDF">
<html>
<head>
</head>
<body>
<table style="border-collapse: collapse; ">
<apex:repeat value="{!wrapperList}" var="row">
<tr style="border: 1px solid rgb(221, 219, 218); width:700px;">
<apex:repeat value="{!row.values}" var="value">
<td style="border: 1px solid rgb(221, 219, 218); padding: 15px; ">{!value}</td>
@arun12209
arun12209 / RecordList.cmp
Created February 9, 2019 17:30
RecordList.cmp
<aura:component controller="ListComponentCntrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="data" type="Contact[]" />
<aura:attribute name="UnfilteredData" type="Contact[]" />
<aura:attribute name="filter" type="String" />
<aura:handler name="change" value="{!v.filter}" action="{!c.doFilter}" />
<div class="slds-page-header">My Contacts</div>
<lightning:input name="x" value="{!v.filter}" label="Filter" placeholder="Search Contact by "/>
<table class="slds-table slds-table--bordered">
<thead>
({
doInit :function(component,event,helper){
// Apex method definition
var action = component.get("c.loadData");
// callbak function
action.setCallback(this,function(response){
//get state
var state = response.getState();
// check if state is 'SUCCESS'
if(state == 'SUCCESS'){