Skip to content

Instantly share code, notes, and snippets.

View srujan21's full-sized avatar

GANGASRUJAN GURUDU srujan21

View GitHub Profile
recordid=ApexPages.currentPage().getParameters().get('CA_Info');
if(recordid!=null && recordid!='')
{
if(recordid.contains(' '))
recordid=recordid.replace(' ','+');
Blob cryptoKey = Blob.valueOf('lmf456ert0123acf');
Blob exampleIv = Blob.valueOf('0ydioopwur12IV12');
Blob data = Encodingutil.base64Decode(String.valueOf(recordid));
Blob decryptedData = Crypto.decrypt('AES128', cryptoKey , exampleIv, data);
recordid= decryptedData.toString();
@srujan21
srujan21 / KnowChildRelationships.cls
Created March 21, 2022 11:32
This will give us all the related child relationship fields for given parent and child sObjects
for (ChildRelationship relationship : SObjectType.sfcloud__Product_Bundle__c.getChildRelationships()){
if (relationship.getChildSObject() == sfcloud__Product_Line_Item__c.sObjectType)
system.debug(relationship.getRelationshipName());
}
test SF to Everyone (6:11 PM)
<section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<header class="slds-modal__header">
<lightning:buttonIcon iconName="utility:close" alternativeText="close"
variant="bare-inverse" class="slds-modal__close" onclick="{!c.handleCancel}" />
</header>
<div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
@srujan21
srujan21 / js
Last active November 15, 2021 09:46
Logic to implement timer in lightning component
startTimer : function(component, event, helper) {
console.log('Timer started >>> ')
var countDownDate = new Date(new Date().getTime() + 2 * 60000);
console.log('countDownDate **** ' + countDownDate);
// Update the count down every 1 second
var timer = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
saveOCR : function(component, event, helper) {
var allRequiredInputs = component.find("requiredInput");
allRequiredInputs.push(component.find('firstElement'));
var requiredInputs = [];
var erroredComponentNames = [];
allRequiredInputs.forEach(function(element) {
if(element.get('v.required') == true) {
if(element.get("v.class") != 'standardComponent') {
requiredInputs.push(element);
}
<apex:page showHeader="true">
<script>
var cPattern = 'curl=';
var lPattern = 'lurl=';
var fullUrl = document.URL;
var curl;
var lurl;
if(!(fullUrl.includes(cPattern) && fullUrl.includes(lPattern))) {
@srujan21
srujan21 / getFile.cls
Created February 7, 2020 06:53
Get the file from Salesforce library
//Get file from library
SELECT Id, RootContentFolderId FROM ContentWorkspace WHERE Name = 'Historical' LIMIT 1
//0583F000000EsFVQA0
SELECT Id, ContentDocument.LatestPublishedVersion.VersionData FROM ContentDocumentLink WHERE LinkedEntityId = '0583F000000EsFVQA0'
@srujan21
srujan21 / ExceptionLogUtilityClass.cls
Created February 3, 2020 11:19
Code to capture Exceptions and errors
/**************************************************
* Class: ExceptionLogUtilityClass
* Author: Soljit - SR
* Date: 2019-06-18
*
* Description: Utility class which can be called to insert Exception logs
*
* V1.0: Initial
*
****************************************************/
@srujan21
srujan21 / quictActionForm.cmp
Created January 29, 2020 08:49
A sample lightning form along with Quick Action
<aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="SourceSendEmailController">
<aura:attribute name="subject" type="String" />
<aura:attribute name="emailId" type="String" />
<aura:attribute name="body" type="String" />
<lightning:input aura:id="emailform" name="input2" label="Email Id" value = "{!v.emailId }" required="true"/>
<lightning:input aura:id="emailform" name="input1" label="Subject" value = "{!v.subject }" required="true"/>
<lightning:textarea aura:id="emailform" name="input3" label="Body" value = "{!v.body }" required="true"/>
<br/>
@srujan21
srujan21 / showToast.js
Created January 29, 2020 08:17
show toast message in lightning aura component
showToast : function(component, event, helper, message, title, type) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
"title": title,
"message": message,
"type": type || "other"
});
toastEvent.fire();
}