Skip to content

Instantly share code, notes, and snippets.

{
"clientId": "lxdl9o32njygi1gj47kgfaga4k",
"data": {
"event": {
"createdDate": "2018-04-11T09:34:50.694Z",
"replayId": 4,
"type": "updated"
},
"sobject": {
"PackageType__c": "BEST_BEFORE_DATE",
PushTopic pushTopic = new PushTopic();
//Channel Name
pushTopic.Name = 'ProductUpdates';
//Define the query which will be used to create the payload
pushTopic.Query = 'SELECT Id, SKU__c, PackageType__c, ShelfLife__c FROM E_Product__c
pushTopic.ApiVersion = 42.0;
/**
These scripts will only work in Salesforce classic.
**/
//For Edit access column
var arrayEdit = document.getElementsByClassName('displayedCol');
for(i=0;i<arrayEdit.length;i++){
if(arrayEdit[i]['firstElementChild']!= undefined)
arrayEdit[i]['firstElementChild'].checked = true;
}
String key = 'hgdhdhhdjfh12ehsn';
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk';
//Generating current Unix timestamp (in seconds)
String getTime = string.valueOf(Datetime.Now().getTime()/1000);
String requestInput = key + secret + getTime;
Blob requestBlob = Blob.valueOf(requestInput);
Blob hash = Crypto.generateDigest('MD5', requestBlob);
//Need to convert into hex to generate the equivalent of md5(string) method of PHP.
({
//Global variables
$projects:{},
$employees: {},
$manager: {},
doInit : function(cmp) {
this.$projects = this.initAutoComplete(cmp, 'projects', ["Project1", "Project2", "Project3"]);
this.$employees = this.initAutoComplete(cmp, 'employees', ["Emp1", "Emp2", "Emp3"]);
@HemantShukla
HemantShukla / IdeaDescribeLayout
Created March 12, 2016 20:28
Describe layout for Picklist values based on Record type
<apex:page >
<apex:includescript value="/soap/ajax/20.0/connection.js"/>
<apex:includescript value="/soap/ajax/24.0/apex.js"/>
<apex:includeScript value="https://code.jquery.com/jquery-2.2.1.min.js" />
<script>
sforce.connection.sessionId = '{!$Api.Session_ID}';
var layout, recordTypeMap;
FinalResult = new Array();
@HemantShukla
HemantShukla / Custom Attrs
Created March 12, 2016 19:37
Custom Attrs usage
<apex:page standardcontroller="Account">
<apex:repeat value="{!Account.contacts}" var="con">
<apex:outputPanel html-did="{!con.Id}" onclick="console.log(this.getAttribute('did'));">
{!con.firstName} <br />
</apex:outputPanel>
</apex:repeat>
</apex:page>
@HemantShukla
HemantShukla / ChatterFollow-Page.page
Last active March 12, 2016 17:47
Implementation of custom chatter component
<apex:page controller="chatterHacksController" standardStylesheets="false" showHeader="false">
<!-- Placeholder to instantiate the chatter methods on page. ->
<div style="display:none">
<chatter:follow entityId="00590000004OupA" /> <br />
</div>
<c:ChatterFollow entityId="00590000004OupA" networkId="000000000000000" activityType="unfollow"/>
<c:ChatterFollow entityId="00590000004OupA" networkId="000000000000000" activityType="unfollow"/>
<c:ChatterFollow entityId="00590000004OupA" networkId="000000000000000" activityType="unfollow"/>
</apex:page>
@HemantShukla
HemantShukla / ChatterFollow-component.component
Created March 12, 2016 17:30
Custom chatter Follow component
<apex:component>
<apex:attribute name="entityId" type="string" description="This would be Id of User/Record which need to be followed" required="true"/>
<apex:attribute name="networkId" type="string" description="This would be the Id of the network in which the container page would be running" required="true"/>
<apex:attribute name="activityType" type="string" description="To render the right block on load based on entity is already followed or not" required="true"/>
<div class="zen">
<!-- Two important params here which would be dynamic based on context and usage
1. data-sfdc-entity-id: This need to be set as User/Record Id which need to be follow/un-follow