Skip to content

Instantly share code, notes, and snippets.

View msrivastav13's full-sized avatar
🎯
Focusing

Mohith Shrivastava msrivastav13

🎯
Focusing
View GitHub Profile
@msrivastav13
msrivastav13 / Boost Your Developer Productivity with Modern Tools.md
Last active July 17, 2024 14:34
Boost Your Developer Productivity with Modern Tools

Code Builder

Sign up for a Salesforce org

  1. Follow the instructions of your instructor to get a Salesforce org provisioned with Code Builder.

  2. Make sure you write down your user id and password. You'll need them again later in this workshop.

  3. In your browser, go to login.salesforce.com and log in to your org.

Getting Started with Salesforce CLI

Overview

This tutorial will guide you through the process of installing Salesforce CLI, authenticating to a Salesforce Org, creating a Salesforce project, connecting your development org to the project, retrieving metadata, and deploying metadata from your local machine to the Salesforce org.

What Developers Will Do

  1. Install Salesforce CLI (Skip if using Code Builder)
  2. Authenticate to Salesforce Org via CLI
@msrivastav13
msrivastav13 / salesforce_prompt_builder_pocket_guide_for_apex_developers.md
Last active April 25, 2024 03:27
codeLive: A Deep Dive into Apex for Prompt Builder

What is Prompt Builder?

Prompt Builder from Salesforce is a powerful tool that enables organizations to add generative AI capabilities to their business application. It allows organizations to create and manage prompt templates.

What is Prompt Builder?

Prompts

Sets of questions or instructions provided to a large language model to generate relevant content. To learn more complete the trailhead module below

@msrivastav13
msrivastav13 / SavePointReleaseCalloutExample.cls
Last active February 2, 2024 03:52
Example to show the callout after DML rollback in Apex with new Database.releaseSavepoint
// This class works if your class -meta.xml is of 60.0 version
public with sharing class SavePointReleaseCalloutExample {
public void basicAuthCallout() {
// Do a DML before callout
Savepoint sp = Database.setSavepoint();
Account acc = new Account();
acc.Name = 'Test';
@msrivastav13
msrivastav13 / csvtojson.js
Created December 28, 2023 17:35
Converts SnowFakery generated test data to the JSON format for loading via Salesforce CLI
import csvtojson from 'csvtojson';
import fs from 'fs/promises';
// Define a reusable function for converting CSV to JSON
const convertCsvToJson = async (
csvFilePath,
jsonFilePath,
objectType,
idPrefix = ''
) => {
@msrivastav13
msrivastav13 / manifest.YAML
Created November 23, 2021 22:51
Sample manifest for slack app
_metadata:
major_version: 1
minor_version: 1
display_information:
name: Salesforce Slack Starter App
features:
bot_user:
display_name: Salesforce Slack Starter App
always_online: true
shortcuts:
@msrivastav13
msrivastav13 / tasks.json
Created July 15, 2021 04:01
Changeset in Salesforce
{
"version": "2.0.0",
"tasks": [
{
"label": "Retrieve From ChangeSet",
"type": "shell",
"command": "sfdx",
"args": [
"force:source:retrieve",
"-n",
@msrivastav13
msrivastav13 / tasks.json
Created July 15, 2021 03:20
EasySpaces Task for Setting up scratch org
{
"version": "2.0.0",
"tasks": [
{
"label": "Create Scratch org",
"type": "shell",
"command": "sfdx",
"args": [
"force:org:create",
"-s",
@msrivastav13
msrivastav13 / CI.yml
Last active October 12, 2021 09:04
Simple github action YML to deploy experience cloud site to salesforce orgs
# Unique name for this workflow
name: Salesforce CI
# Definition when the workflow should run
on:
push:
branches:
- '*'
# Jobs to be executed
jobs:
@msrivastav13
msrivastav13 / slack_salesforce_oauth
Last active July 15, 2021 15:20
Slack Salesforce OAuth
const { App, LogLevel, ExpressReceiver } = require('@slack/bolt');
const jsforce = require('jsforce'); //jsforce open source library to connect to Salesforce
// Create Salesforce Connection
const oauth2 = new jsforce.OAuth2({
// you can change loginUrl to connect to sandbox or prerelease env.
// loginUrl : 'https://test.salesforce.com',
clientId: process.env.SALESFORCE_CLIENT_ID,
clientSecret: process.env.SALESFORCE_CLIENT_SECRET,
redirectUri: 'https://94d7e0bbbc0e.ngrok.io/salesforce/oauth_redirect'