Skip to content

Instantly share code, notes, and snippets.

View nithesh1992's full-sized avatar

Nithesh Nekkanti nithesh1992

View GitHub Profile
@nithesh1992
nithesh1992 / downloadapexlogs.sh
Last active February 11, 2023 20:40
Download Apex Logs
#!/bin/bash
Ids=`sfdx data query -q 'SELECT id FROM ApexLog' --json | jg -r
'.result.records[].Id'`
while IFS= read -r line; do
echo "sfdx apex log get -i $line -d .sfdx/tools/debug/logs"
sfdx apex log get -i $line -d .sfdx/tools/debug/logs/
done <<< "$Ids"
@nithesh1992
nithesh1992 / day-dif.txt
Created October 8, 2021 06:21 — forked from sayyedhammadali/day-dif.txt
Find the number of days between two dataes
const dayDif = (date1, date2) => Math.ceil(Math.abs(date1.getTime() - date2.getTime()) / 86400000)
dayDif(new Date("2020-10-21"), new Date("2021-10-22"))
// Result: 366
const copyToClipboard = (text) => navigator.clipboard.writeText(text);
copyToClipboard("This Sring is Copied To Clipboard.");
@nithesh1992
nithesh1992 / ApexScheduler.cls
Last active June 27, 2020 01:32
Scheduled APEX - dynamic run time batch instance (Intriguing Design Pattern)
global class ApexScheduler implements Schedulable {
String className;
global ApexScheduler(String className){
this.className = className;
}
public Interface IScheduler {
void execute(SchedulableContext sc);
}
@nithesh1992
nithesh1992 / UsersWithPermission.apex
Created June 18, 2019 16:45
Find Users with Custom Permission in Apex
Set < Id > permissionSetIds = new Set < Id >();
List < User > userList = new List < User >();
for ( SetupEntityAccess access : [ SELECT ParentId FROM SetupEntityAccess
WHERE SetupEntityId IN ( SELECT Id
FROM CustomPermission
WHERE DeveloperName = 'Allow_Save_Offer_Owner_Edit' )
]){
permissionSetIds.add(access.ParentId);
}
System.debug(permissionSetIds);
@nithesh1992
nithesh1992 / .hyper.js
Created May 7, 2019 16:57
Hyper JS Config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',

Service Components

DML

Aura Methods: [ bulkInsert, bulkUpdate, bulkDelete ]

// In cmp
      <c:DML sObjectType="Contact" aura:id="dmlUtil" />    
@nithesh1992
nithesh1992 / AutoDocGeneration_Mergefields.js
Last active September 13, 2018 13:15
Google Apps Scripts (Auto G Doc to PDF conversion and Email Scripts)
// Row number from where to fill in the data (starts as 1 = first row)
var CUSTOMER_ID = 2; // 1st row may contains column headers
// Google Doc id from the document template
// (Get ids from the URL)
var SOURCE_TEMPLATE = "sdsv";
// In which spreadsheet we have all the customer data
var CUSTOMER_SPREADSHEET = "svs";
@nithesh1992
nithesh1992 / SFDX Commands.md
Created November 28, 2017 16:13
SFDX Commands

Logging in

sfdx force:auth:web:login --setalias <sandbox name> --instanceurl https://test.salesforce.com

Org List

sfdx force:org:list
@nithesh1992
nithesh1992 / Get Session ID
Created November 16, 2017 16:43
Get Session Id Salesforce in JS Console
document.cookie.match(/(^|;\s*)sid=(.+?);/)[2];