Skip to content

Instantly share code, notes, and snippets.

View snugsfbay's full-sized avatar

SnugSFBay snugsfbay

View GitHub Profile
@afawcett
afawcett / README.md
Last active November 25, 2018 10:10
Apex MD API and XSLT

Requirement

Perform XSLT transform on XML returned from the Salesforce Metadata API retrieve operation (also requires unzip). Based on the code in https://github.com/financialforcedev/apex-mdapi

Solution

Adapting the metadataretrieve.page in the above repository. The original page passed the client side unzipped files from the MD retrieve zip file back to the server to add to the view state for display. As the XSLT is done client side, the above page is much simpler, the unzipped files are just handled client side and added dynamically to the page DOM.

Implementaiton Notes

  • XSLT is loaded from a static resource
@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
@FishOfPrey
FishOfPrey / DeveloperConsoleOpenLogById.js
Last active August 30, 2018 22:03
Have the Salesforce Developer Console open a debug log by ID
var logId = "07Lc000001OiO8GEAV";
apex.ide.Viewer.open({
id: "l-" + logId,
logId: logId,
Name: "Log " + logId,
xtype: "logviewer",
rawLogSize: 1
});
<apex:page docType="html-5.0" sidebar="false">
<apex:stylesheet value="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"/>
<script>
jQuery(document).ready(function($) {
$.ajax('/services/data/v38.0/limits',
{
beforeSend: function(xhr) {
// Set the OAuth header from the session ID
@joshbirk
joshbirk / SpeedTest Apex Controller
Last active March 29, 2019 20:04
Lightning Chart Component w/ D3.js
public with sharing class SpeedTestController {
@AuraEnabled
public static List< SpeedTest__c > getData() {
List<SpeedTest__c> speeds = [SELECT ID, TimeString__c,Download__c,Upload__c from SpeedTest__c LIMIT 1000];
return speeds;
}
}
@afawcett
afawcett / AddPicklistItemAction.cls
Last active January 4, 2023 11:47
Prototype Invocable Method wrapping the Salesforce Metadata API to allow management of Picklist Items via Process Builder and Visual Flow
/**
* Copyright (c) 2015, FinancialForce.com, inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,