Skip to content

Instantly share code, notes, and snippets.

'use strict';
const jwt = require('salesforce-jwt-bearer-token-flow');
const jsforce = require('jsforce');
require('dotenv').config();
const { SF_CONSUMER_KEY, SF_USERNAME, SF_LOGIN_URL } = process.env;
let SF_PRIVATE_KEY = process.env.SF_PRIVATE_KEY;
/**
* Get list of all orders for the user
*
* type String json or xml
* pOSTDATA List Creates a new employee in DB (optional)
* returns List
**/
exports.typePost_orderPOST = function(type,pOSTDATA) {
return new Promise(function(resolve, reject) {
var examples = {};
/{type}/get_inventory/:
get:
tags:
- "Internal calls"
description: "Get Inventory"
operationId: "typeGet_inventoryGET"
consumes:
- "application/json"
produces:
- "application/json"
@mbraga-sfdc
mbraga-sfdc / calculate_storage.sql
Last active December 14, 2020 17:37
Calculate required storage: When evaluating the required database size, measure the historical growth of your existing Salesforce data. This can be done using a SOQL query similar to the one here.
SELECT calendar_month(CreatedDate), COUNT(Id)
FROM Account
WHERE CreatedDate = LAST_FISCAL_YEAR
GROUP BY calendar_month(CreatedDate)
ORDER BY COUNT(Id) DESC
@mbraga-sfdc
mbraga-sfdc / heroku_aggregated_data_view.sql
Created November 10, 2020 21:35
Heroku aggregated data view from the Multi-org visibility for Work.com blog post
CREATE OR REPLACE VIEW global_assessment as
SELECT employeecrisisassessment.sfid AS id,
employeecrisisassessment.assessment,
employeecrisisassessment.assessmentdate,
employee.lastname, employee.firstname,
'geo designation' AS geo
FROM <schema name>.employeecrisisassessment, <schema name>.employee
WHERE employeecrisisassessment.employeeid = employee.sfid
UNION [repeated select for each of our other schemas];
@mbraga-sfdc
mbraga-sfdc / heroku_data_view_amer_emea.sql
Last active December 14, 2020 17:36
data view for Multi_org visibility for work.com blog post #2
CREATE OR REPLACE VIEW global_assessment as
SELECT employeecrisisassessment.sfid AS id,
employeecrisisassessment.assessment,
employeecrisisassessment.assessmentdate,
employee.lastname, employee.firstname,
'AMER' AS geo
FROM amer.employeecrisisassessment, amer.employee
WHERE employeecrisisassessment.employeeid = employee.sfid
UNION
SELECT employeecrisisassessment.sfid AS id,
@mbraga-sfdc
mbraga-sfdc / heroku_data_view_for_accounts_contacts.sql
Last active December 14, 2020 17:36
data view for multi-org visibility for work.com blog post #3
CREATE OR REPLACE VIEW global_assessment as
SELECT contact.sfid as id, industry, account.name, phone, fax,
lastname, firstname, email, mobilephone,
'AMER' AS geo
FROM amer.account, amer.contact
WHERE amer.account.sfid = amer.contact.accountid
UNION
SELECT contact.sfid as id, industry, account.name, phone, fax,
lastname, firstname, email, mobilephone,
'EMEA' AS geo
@mbraga-sfdc
mbraga-sfdc / configure_external_datasource.txt
Created November 10, 2020 21:39
configure external data source steps for Multi-Org Visibility for work.com blog post
1. Click the gear icon in the upper-right corner.
2. Click Setup.
3. Enter “External” in the Quick Find box and click External Data Sources.
4. Click New External Data Source. For the New External Data Source screen, fill in the values as follows:
a. External Data Source: (any name will work)
b. Type: Salesforce Connect: OData 4.0 (choosing this option will add a set of parameters to the screen)
c. URL: This the Service URL from the Heroku Connect External Objects page, as highlighted in step 5a. It will be unique to your Heroku Connect instance.
d. Identity Type: Named Principal
e. Authentication Protocol: Password Authentication
f. Username: The value from the User field, as highlighted in step 5a.
Tool Features
Apex Interactive Debugger and Apex Replay Debugger (Salesforce Extension Pack for VS Code) Troubleshoot your Apex code by inspecting debug logs using Visual Studio Code as the client.
AppExchange Find ready-to-install solutions that extend Salesforce capabilities in this marketplace
Browser Developer Tools (e.g. Chrome DevTools ) Help LWC developers to inspect, profile and audit lightning components
Linting - Lightning Web Component Identify errors about malformed code against established patterns with Lightning Component development
[Platform Event Usage Monitor](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000EJdpoUAD
Tool Features
Developer Console Query Plan Tool View query plans for SOQL queries, SOSL searches, reports, and list views in order to optimize and speed up queries done over large numbers of records. Refer to the Query Plan Tool FAQ and Lightning Platform Query Optimization FAQ
Eagle eyes- Performance monitoring powered by Event Monitoring View and interpret performance from Event Monitoring based on established best practices
Event Log Browser A Salesforce connected web app to access and download event log files
Event Monitoring Analytics App A set of prebuilt dashboar