Skip to content

Instantly share code, notes, and snippets.

View lukaszhanusik's full-sized avatar
✨👁️🖤👁️✨ ⚡️

Lukasz Hanusik lukaszhanusik

✨👁️🖤👁️✨ ⚡️
View GitHub Profile
@lukaszhanusik
lukaszhanusik / README.md
Last active July 9, 2019 14:02
Support SQL Stored Procedures

Support SQL Stored Procedures

Version available externally from GitHub Gist

Install Git

There are several ways to install Git on a Mac. In fact, if you've installed Xcode (or Xcode Command Line Tools), Git may already be installed. To find out, open brand new terminal window (outside of livedb) and enter git --version.

git --version
@lukaszhanusik
lukaszhanusik / Address.cls
Created December 14, 2020 08:11 — forked from afawcett/Address.cls
Apex Address compound type, based on that provided in Spring'14 for Salesforce API, http://www.salesforce.com/us/developer/docs/api/Content/compound_fields_address.htm
public class Address
{
// Internally used to determine if valueOf method should read the state and country picker fields
private static Boolean stateAndCountryPickersEnabled = false;
static
{
// Are State and Country pickers enabled in this org?
Map<String, Schema.SObjectField> accountFields = Account.sObjectType.getDescribe().fields.getMap();
stateAndCountryPickersEnabled = accountFields.containsKey('BillingStateCode');
@lukaszhanusik
lukaszhanusik / eventCreation.txt
Created June 24, 2021 17:59 — forked from brianbier/eventCreation.txt
All possible Options for creating an event, Since It doesn't work for regular lightning components
window.open('/lightning/o/Event/new');
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/lightning/o/Event/new"
});
urlEvent.fire();
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
@lukaszhanusik
lukaszhanusik / CurrencyUpdater
Created July 1, 2021 14:47 — forked from goravseth/CurrencyUpdater
Pulls current rates and updates CurrencyType records in SFDC
public class CurrencyUpdater {
list <CurrencyType> ctl = new list<CurrencyType>([SELECT Id,IsoCode,ConversionRate FROM CurrencyType WHERE IsActive = TRUE AND IsCorporate = FALSE]);
map <string, CurrencyType> ctMap = new map<String, CurrencyType>();
public CurrencyUpdater () {
for (CurrencyType ct : ctl){
ctMap.put(ct.IsoCode,ct);
}
}
@lukaszhanusik
lukaszhanusik / findDupes
Created July 1, 2021 14:48 — forked from goravseth/findDupes
invocable apex to find duplicate contacts using the new findDuplicates apex stuff
public class Flow_FindDupes {
//https://developer.salesforce.com/forums/?id=906F0000000AzDeIAK
@InvocableMethod(label='Get Dupes' description='Returns something')
public static List<Contact> getDuplicateContacts(List<Contact> contacts) {
system.debug('contacts size = ' + contacts.size());
list<sObject> dasContacts = new list<sobject>();
dasContacts.addall((List<sObject>)(contacts));
list<Contact> duplicateContacts = new list<Contact>();
{
// NOTE: WorkspaceAPI implementation in LWC directly. To be explored
invokeWorkspaceAPI(methodName, methodArgs) {
console.log('invokeWorkspaceAPI: ');
return new Promise((resolve, reject) => {
const apiEvent = new CustomEvent("internalapievent", {
bubbles: true,
composed: true,
cancelable: false,
@lukaszhanusik
lukaszhanusik / lwc-LMS-MessageChannel.js
Last active July 17, 2021 15:37
LWC LMS MessageChannel
import {
subscribe,
unsubscribe,
APPLICATION_SCOPE,
publish,
MessageContext
} from 'lightning/messageService';
import INTERNAL_MESSAGE_CHANNEL from '@salesforce/messageChannel/InternalMessageChannel__c';
@lukaszhanusik
lukaszhanusik / url-button.txt
Created July 17, 2021 20:32
URL Button Options
/*{!URLFOR("lightning/cmp/c__templateBuilder", null, [c__quickTextId=QuickText.Id])}*/
/*/flow/QuickTextTemplateEditor?quickTextId={!CASESAFEID(QuickText.Id)}&userThemeDisplayed={!$User.UIThemeDisplayed}*/
@lukaszhanusik
lukaszhanusik / templateMessageBuilder.js
Created July 24, 2021 00:24
LWC LDS Wire Apex Refresh Notify
import { LightningElement, api, wire } from 'lwc';
import { getRecord, getFieldValue, getRecordNotifyChange, updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { refreshApex, getSObjectValue } from '@salesforce/apex';
import getTemplateRecord from '@salesforce/apex/TemplateBuilderController.getTemplateRecord';
import updateTemplateRecord from '@salesforce/apex/TemplateBuilderController.updateTemplateRecord';
const ENTITY_FIELDS = {
"574" : {
@lukaszhanusik
lukaszhanusik / lwc-slot-onslotchangeevent.js
Created July 25, 2021 12:34
LWC Slot handleSlotChange
// _slotComboboxAddon;
// _slowComboboxContainer;
@track _slots = {};
handleSlotChange(event) {
const slot = event.target;
this._slots[slot.name] = (slot.assignedElements().length !== 0);
// if (slot.name === 'combobox-addon') {
// this._slotComboboxAddon = (slot.assignedElements().length !== 0);
// this._slots[slot.name] = (slot.assignedElements().length !== 0);
// const slotHasElements = slot.assignedElements().length !== 0;