Skip to content

Instantly share code, notes, and snippets.

View kiran-machhewar's full-sized avatar

Kiran Machhewar kiran-machhewar

View GitHub Profile
@kiran-machhewar
kiran-machhewar / Logger.cls
Created October 20, 2013 17:02
Custom Logger
public with sharing class Logger {
public static List<LogInfo> logs {get;set;} //This will hold all the logs in each transaction
//Wrapper class to hold log content
//Used wrapper so as to leave space for further improvments
public class LogInfo{
private String logBody = '';
@kiran-machhewar
kiran-machhewar / LogPushTopic.cls
Created October 20, 2013 17:51
Log Push Topic
PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'Log';
pushTopic.Query = 'SELECT Id, Name, Log_Type__c From Log__c';
pushTopic.ApiVersion = 29.0;
pushTopic.NotifyForOperationCreate = true;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationUndelete = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
insert pushTopic;
@kiran-machhewar
kiran-machhewar / Console.page
Created October 21, 2013 03:09
Console.page
<apex:page controller="ConsoleController" sidebar="false" showHeader="false">
<apex:includeScript value="{!$Resource.cometd}"/>
<apex:includeScript value="{!$Resource.jquery}"/>
<apex:includeScript value="{!$Resource.json2}"/>
<apex:includeScript value="{!$Resource.jquery_cometd}"/>
<style>
.AssertException{
background-color: yellow;
}
.Exception {
@kiran-machhewar
kiran-machhewar / ConsoleController.cls
Created October 21, 2013 03:12
ConsoleController
public without sharing class ConsoleController{
public List<Log__c> logList {set;get;}
public ConsoleController(){
logList = new List<Log__c>();
}
public PageReference refreshLogs(){
String logId = ApexPages.currentPage().getParameters().get('logid');
<apex:page sidebar="false" showHeader="false">
<script>
window.open('/apex/ChildPage','name','height=450,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
function reloadPage(url){
window.location=url;
}
</script>
</apex:page>
<apex:page >
<script>
if(confirm('Do you want to reload parent window by closing this child window?')){
top.window.opener.reloadPage('/home/home.jsp');
top.window.close();
}
</script>
</apex:page>
<apex:page standardController="<Your custom/standard object api name>">
<apex:detail subject="{!<Your custom/standard object api name>.Id}" relatedList="true" title="true"/>
</apex:page>
@kiran-machhewar
kiran-machhewar / Loading.component
Created December 31, 2013 04:30
Showing busy icon.
<apex:component >
<style>
body.wait, body.wait *{
cursor: wait !important;
}
</style>
<script>
//overriding the default send function of XMLHttpRequest
function addXMLRequestCallback() {
package metadata;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Calendar;
import java.util.List;
import com.sforce.soap.metadata.*;
import com.sforce.soap.partner.PartnerConnection;
<apex:page controller="CallOutUtil" standardStylesheets="false" showHeader="false" sidebar="false">
<customTag><apex:outputText value="{!data}" escape="false"/></customTag>
</apex:page>