Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Vaidyan tvaidyan

View GitHub Profile
@tvaidyan
tvaidyan / DemoTriggerHandler.cls
Created Sep 15, 2021
A Hello World Apex HTTP Callout Example
View DemoTriggerHandler.cls
public class DemoTriggerHandler {
@future (callout=true)
public static void sendTestRequest(string field1, string field2, string field3) {
try{
HttpRequest request = new HttpRequest();
request.setMethod('POST');
request.setEndpoint("my external api url goes here");
request.setBody('{"message":"Hello World"}');
View magick.cs
using ImageMagick;
...
using var heicImage = new MagickImage(@"C:\my-heic-file.heic");
heicImage.Write(@"C:\my-new-jpg-file.jpg");
@tvaidyan
tvaidyan / AnimalLocator.cls
Created May 20, 2021
Salesforce Trailhead > APEX Integration Services > Apex REST Callouts
View AnimalLocator.cls
public class AnimalLocator {
public static string getAnimalNameById(Integer id){
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + id);
request.setMethod('GET');
HttpResponse response = http.send(request);
string animalName = null;
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
@tvaidyan
tvaidyan / ClaimController.apxc
Created May 14, 2021
A Salesforce Apex Class defining a REST API
View ClaimController.apxc
@RestResource(urlMapping='/v1/claim/')
global class ClaimController {
@httpGet
global static List<Claim__c> GetClaims(){
List<Claim__c> claims = new List<Claim__c>();
claims = [Select Name, FirstName__c, LastName__c, FavoriteColor__c From Claim__c];
return claims;
}
@httpDelete
View generate-insert-statements.sql
-- Code to generate INSERT statements from query results. Got this from:
-- https://stackoverflow.com/questions/4526461/converting-select-results-into-insert-script-sql-server
CREATE PROCEDURE sp_generate_insertscripts
(
@TABLENAME VARCHAR(MAX),
@FILTER_CONDITION VARCHAR(MAX)=''
)
AS
BEGIN
@tvaidyan
tvaidyan / webdev_online_resources.md
Created Jul 24, 2018 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
View webdev_online_resources.md