Skip to content

Instantly share code, notes, and snippets.

View bmodeprogrammer's full-sized avatar
🎯
Focusing

Elias Pinheiro bmodeprogrammer

🎯
Focusing
View GitHub Profile
@bmodeprogrammer
bmodeprogrammer / AccountService.cls
Created April 22, 2023 17:21
get all updatable fields from account and describe it for lwc
public with sharing class AccountsService {
public string getAllFieldsAndValues(String accIdA, String accIdB) {
final Set<String> systemFields = new Set<String> {
'CreatedDate',
'CreatedById',
'LastModifiedById',
'LastModifiedDate'
};
try {
@bmodeprogrammer
bmodeprogrammer / JWTAuthAccountService.cls
Created May 4, 2022 14:50
JWT Authentication Account Service Apex Salesforce
public class JWTAuthAccountService {
/*
{
"private_key_id": ".....",
"private_key": "-----BEGIN PRIVATE KEY-----[KEY HERE, REMOVE "\n" LINEBREAKS]-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "....apps.googleusercontent.com",
"type": "service_account"
}
@bmodeprogrammer
bmodeprogrammer / SObjectService.cls
Created February 19, 2021 23:16
From a list of SObject and a field Api Name returns a Map with a list of SObject per field value
/*
* Example: Get a map of list of contacts by status from list of contacts
* @param: List<SObject> objects
* @param: String fieldName - field Api Name of a text field
* @return Map<String, List<SObject>> sObjectListByString
*/
public static Map<String, List<SObject>> getSObjectListByString(List<SObject> objectList, String fieldName) {
Map<String, List<SObject>> sObjectListByString = new Map<String, List<SObject>>();
String fieldValue;
@bmodeprogrammer
bmodeprogrammer / gladiatus.js
Created November 30, 2017 17:08
expedition, arena and filter auction and attack on circus automaticly
setTimeout(function () {
"use strict";
const waiting_timeA = 1 * 60000,
waiting_timeB = 1 * 60000,
monster_type = 0, // 0 - 3
current_exp = 'kkkkkkkkkk',
words_missions = ['masmorras', 'Campo Viking'],
good_items = ['poirins', 'liths', 'zeindras', 'ibiwans', 'kerrannas', 'facilidade', 'bacias', 'sugos', 'delicadeza', 'magia', 'conflito', 'rapidez', 'brilho', 'rayols', 'Erradica', 'espalhan', 'lucro', 'thiens', 'frabos', 'perdi'],
merce = ['herege', 'grande mestre', 'lanceiro de elite'],
merceMinLevel = 60,
@bmodeprogrammer
bmodeprogrammer / staticResourceUrl.js
Created September 28, 2017 19:50
Dynamic static resource url - Salesforce
const url = 'resourceName/' + date.now() + '/path';
@bmodeprogrammer
bmodeprogrammer / getDependentPickListsValues.js
Last active August 28, 2018 13:11 — forked from boxfoot/getDependentPicklists.cls (2017 approach)
Get dependent picklist values javascript remoting
/**
* getDependentPicklistOptions
* by Benj Kamm, 2012
* (inspired by http://iwritecrappycode.wordpress.com/2012/02/23/dependent-picklists-in-salesforce-without-metadata-api-or-visualforce/)
* CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/us/)
*
* Build an Object in which keys are valid options for the controlling field
* and values are lists of valid options for the dependent field.
*
* Method: dependent PickListEntry.validFor provides a base64 encoded
@bmodeprogrammer
bmodeprogrammer / getPicklistValues.html
Last active April 13, 2017 09:00
Get picklist values JavaScript Remoting
<script src="/soap/ajax/39.0/connection.js" type="text/javascript"></script>
<script>
sforce.connection.sessionId = '{!$Api.Session_ID}';
var result = sforce.connection.describeSObject("Opportunity");
for (var i = 0, size = result.fields.length; i < size; i++) {
var field = result.fields[i];