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 / 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'
@msrivastav13
msrivastav13 / tasks.json
Created October 24, 2020 00:23
This is task.json for tailing logs
{
"version": "2.0.0",
"tasks": [
{
"label": "SFDX: Tail Logs",
"type": "shell",
"command": "sfdx",
"args": [
"force:apex:log:tail",
"-c",
@msrivastav13
msrivastav13 / tasks.json
Created October 12, 2020 21:02
This one is for Retrieving org metadata using packages
{
"version": "2.0.0",
"tasks": [
{
"label": "SFDX: Retrieve Metadata From Package",
"type": "shell",
"command": "sfdx",
"args": [
"force:source:retrieve",
"-n",