Skip to content

Instantly share code, notes, and snippets.

View robertStrunk's full-sized avatar
Living the Dream 😎

Robert Strunk robertStrunk

Living the Dream 😎
View GitHub Profile
public with sharing class DynamicPicklistController {
@AuraEnabled(cacheable=true)
public static List<String> getSObjectNames() {
List<String> sObjects = new List<String>();
for (Schema.SObjectType sObjType : Schema.getGlobalDescribe().values()) {
String name = sObjType.getDescribe().getName();
if (!sObjType.getDescribe().isCustomSetting() &&
!sObjType.getDescribe().isDeprecatedAndHidden() &&
sObjType.getDescribe().isCreateable()) {
@robertStrunk
robertStrunk / example.java
Last active September 3, 2024 16:35
Winter 25 - See Improved Consistency When Iterating Sets.
Set<String> set_string = new Set<String>{'one', 'two', 'three'};
for (String str : set_string) {
System.debug(str);
set_string.remove(str);
System.debug(set_string.contains(str));
}
System.debug(set_string);
@robertStrunk
robertStrunk / query.soql
Created October 12, 2022 23:57
Tooling API query to get dependencies for all LWCs
SELECT MetadataComponentId,
MetadataComponentName,
MetadataComponentType,
RefMetadataComponentId,
RefMetadataComponentName,
RefMetadataComponentType
FROM MetadataComponentDependency
Where RefMetadataComponentType ='LightningComponentBundle'
@robertStrunk
robertStrunk / index.html
Last active October 5, 2022 15:50
LWC Component that communicates with the CPQ QLE via the EasyXDM library.
<template>
<lightning-card>
<pre>{debugVal}</pre>
<div slot="footer">
<lightning-button
name={saveBtn}
variant="brand-outline"
label="Save"
@robertStrunk
robertStrunk / index.html
Last active October 5, 2022 15:45
Lightning:Out VFP with EasyXDM CPQ Integration
<!--
This is a template page that can be used as a starting point when needing to create an EasyXDM enabled
visualforce page that is called by a custom action in order to open custom UIs in the QLE
-->
<apex:page showheader="false" sidebar="false" id="thePage" lightningstylesheets="true" doctype="html-5.0">
<head>
<apex:slds />
<apex:includeLightning />
<title>YOUR TITLE HERE</title>
<script type="text/javascript" src="{!$Resource.SBQQ__easyXDM}"></script>
@robertStrunk
robertStrunk / controller.js
Last active January 11, 2022 17:41
Experience Site datatable workaround
import { LightningElement } from 'lwc';
const LINK = 'link';
export default class ExampleComponent extends LightningElement {
columns = [
{
label: 'Label',
fieldName: 'name'
@robertStrunk
robertStrunk / apex.cls
Last active February 23, 2021 19:53
Unconventional approach to getting a formula field to update in apex. The tradeoff is it consumes extra limits for the queries and DML operations for update and rollback etc. Example is non-bulkified but could easily be made to be so.
// get existing record
SBQQ__Quote__c existingQuote = [
SELECT formula_Field__c
FROM SBQQ__Quote__c
WHERE Id = 'xxxxxxxxxxxxxxxxxx'
];
// capture the current value of the formula field
Decimal oldFormulaValue = existingQuote.formula_Field__c,
newFormulaValue,