Skip to content

Instantly share code, notes, and snippets.

View kbs5280's full-sized avatar

Kris Sparks kbs5280

View GitHub Profile
@kbs5280
kbs5280 / DoseSpotAPI_v12_2017_01_05.MedicationListItem.java
Created October 15, 2019 16:31
DoseSpotAPI_v12_2017_01_05.MedicationListItem
DoseSpotAPI_v12_2017_01_05.GetMedicationListResponse response = apisoap.getMedicationList(signon, DoseSpot_ID, sources, statuses);
response_package.json_response = JSON.serializePretty(response);
response_package.is_ok = (response.Result.ResultCode == 'OK') ? true : false;
System.debug('Response : ' + response);
if (response.Result.ResultCode == 'OK') {
Integer medication_count;
// Looks like the test on the next line fails in production for 'Philadelphia Test1' which is unexpected. Need to confirm it's using the correct DoseSpot Patient ID and that the API is returning values in 'response' as expected.
try {
@kbs5280
kbs5280 / customer-dynamics.js
Created August 27, 2019 20:27
Customer Dynamics - Selective Consult Inventory Query
// Replace
SELECT id, Apt_Date__c,Arrival_Time__c, Consult_Room__c FROM Consult_Inventory__c WHERE Patient_Phone__c = '{global:SearchANI}' LIMIT 1
// With
SELECT Id, Apt_Date__c, Arrival_Time__c, Consult_Room__c FROM Consult_Inventory__c
WHERE Consult_Room__r.Room_Type__c NOT IN ('Practice','Unconfirmed')
AND (Apt_Date__c >= LAST_N_DAYS:30 AND Apt_Date__c <= TODAY)
AND Special_Initiative__c NOT IN ('Workshop','Group Consult')
AND Pre_Screen_Type__c != 'Seminar'
AND isConsultScheudled__c = 1
@kbs5280
kbs5280 / create-salesforce-project.sh
Last active July 10, 2019 19:37
Create a New Salesforce Project with VS Code
$ sfdx force:project:create --projectname sandbox --manifest
target dir = /Users/developer/workspace/clearchoice
create sandbox/sfdx-project.json
create sandbox/README.md
create sandbox/.forceignore
create sandbox/config/project-scratch-def.json
create sandbox/manifest/package.xml
$ ls
sandbox
@kbs5280
kbs5280 / model2QA.cls
Last active June 26, 2019 19:06
Model 2 QA
FROM Consult_Inventory__c // from the Consult Inventory table
WHERE Scheduled_Time__c >= TODAY // where the Scheduled Time is greater than or equal to today
AND isConsultScheudled__c = 1 // and a Lead or Account is scheduled (it's not an empty block)
AND (Scheduled_Lead__r.Lead_Segment__c = NULL // Lead Segment is null for both Lead and Account
AND Scheduled_Account__r.Lead_Segment__c = NULL)
AND Scheduled_by__r.Name != 'Pat Greenwood' // remove to include Website
AND Scheduled_Lead__r.CreatedBy.Name != 'Website Api' // remove to include Website
AND Scheduled_Account__r.CreatedBy.Name != 'Website Api' // remove to include Website
ORDER BY Scheduled_Time__c // include if you want results ordered
private static Boolean sendable(Lead newLead, Set<Id> scheduledLeadIds) {
Boolean isTestRecord = newLead.Email != null ? newLead.Email.contains('+ostest') : false;
if((newLead.Email != null ||
Utilities.hasPhysicalAddress(newLead.Street, newLead.City, newLead.State, newLead.PostalCode)) &&
(newLead.CreatedDate >= Datetime.now().AddYears(-3) ||
scheduledLeadIds.contains(newLead.Id)) &&
!isTestRecord &&
newLead.Inbound_Call__c != Constants.NonSalesCall &&
newLead.Inbound_Call__c != null &&
List<String> notSendableResults = new List<String>{Constants.DoctorDeclined, Constants.NotCandidate, Constants.ReceivedElsewhere};
Boolean isTestRecord = account.PersonEmail != null ? account.PersonEmail.contains('+ostest') : false;
if((account.PersonEmail != null ||
Utilities.hasPhysicalAddress(account.BillingStreet, account.BillingCity, account.BillingState, account.BillingPostalCode)) &&
(account.CreatedDate >= Datetime.now().AddYears(-3) ||
scheduledAccountIds.contains(account.Id)) &&
!isTestRecord &&
!notSendableResults.contains(account.Consult_Result__c)) {
return true;
Zip_Demographic__c[] leadQueryResnew = Database.query('SELECT Routing_Option__c FROM Zip_Demographic__c LIMIT 1');
System.debug('Routing_Option__c: ' + leadQueryResnew[0].Routing_Option__c);
for(Zip_Demographic__c zip : leadQueryResnew) {
String routingOption = zip.Routing_Option__c;
System.debug('Routing_Option__c: ' + routingOption);
}
@kbs5280
kbs5280 / apex-rest-web-service.js
Last active March 20, 2019 15:57
Apex REST Web Service
@RestResource(urlMapping='/Model2WebService/v1/*')
global with sharing class Model2WebService {
@HttpPost
global static void Model2ApiService() {
// Model2ApiService requires a Lead or Account ID to run
// endpoint: /services/apexrest/Model2WebService/v1?targetId=<Lead ID>
RestRequest request = RestContext.request;
String targetId = request.params.get('targetId');
List<Id> targetIds = new List<Id>{};
@kbs5280
kbs5280 / salesforce-rest-api-sample-request-response.js
Last active July 21, 2022 02:30
Saleforce REST API Sample Request/Response
public class ConnectToSalesforceRestApi {
public static void run(){
String endpoint='https://login.salesforce.com/services/oauth2/token';
// or use this endpoint for a sandbox org:
// String endpoint='https://test.salesforce.com/services/oauth2/token';
String username = 'salesforce-usename@company.com';
String password = 'salesforce-password';
String CONSUMER_KEY = 'clientId';
String CONSUMER_SECRET = 'clientSecret';
@kbs5280
kbs5280 / exercism_setup_for_ruby.md
Last active December 22, 2016 22:27
Exercism.io Setup for Ruby using Homebrew

Exercism.io Setup for Ruby using Homebrew

contributions by Kris Sparks and Brian Sayler

Open your terminal and enter: brew install exercism

If you don't have an exercism.io account, create one on exercism.io. It's easiest to log in with GitHub.

Log into the exercism.io -> click your profile in the top right -> click on API key -> copy and paste the code into your terminal.

Once you have the API key set up ->