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 / tasks.json
Last active October 30, 2020 20:00
Run Salesforce CLI scanner on current file
{
"version": "2.0.0",
"tasks": [
{
"label": "SFDX: Run Security Scan on Current File",
"type": "shell",
"command": "sfdx",
"args": [
"scanner:run",
"-t",
@msrivastav13
msrivastav13 / functions cheat sheet
Last active July 1, 2021 10:22
salesforce functions cheatsheet
//Create a salesforce functions
$ sfdx evergreen:function:init <MyFunction> -l typescript -m force-app/main/default
// Start a function
$ cd functions/MyFunction
$ sfdx evergreen:function:start --verbose
// $ sfdx evergreen:function:invoke \
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ActionLinkGroupTemplate</name>
</types>
<types>
<members>*</members>
<name>ApexClass</name>
</types>
{
"Metadata": {
"actionCalls": [{
"actionName": "emailSimple",
"actionType": "emailSimple",
"connector": null,
"dataTypeMappings": [],
"description": null,
"faultConnector": null,
"inputParameters": [{
@msrivastav13
msrivastav13 / Questionnaireflow.json
Created June 15, 2020 01:13
Questionnaireflow.json
{
"size" : 1,
"totalSize" : 1,
"done" : true,
"queryLocator" : null,
"entityTypeName" : "Flow",
"records" : [ {
"attributes" : {
"type" : "Flow",
"url" : "/services/data/v49.0/tooling/sobjects/Flow/301B00000006sh9IAA"
@msrivastav13
msrivastav13 / Rollback_platform_event
Created April 27, 2020 13:41
Rollback platform events example with Savepoint
List<PlatformEvents__e > events = new List<PlatformEvents__e >();
// Created a PlatformEvents with a Message__c field of 30 characters only, so second event fails
events.add(new PlatformEvents__e(Message__c='Test'));
events.add(new PlatformEvents__e(Message__c='ldjgkfjgkfjkjhkgjhkgjhkghkghkgkhkghkghkghkghkghghkghkghkghkghghkghkghkghkghghkghkghkghkghghkghkghkghkghghkghkghkghkgh'));
Savepoint sp = Database.setSavepoint();
// Call method to publish events
List<Database.SaveResult> results = EventBus.publish(events);
@msrivastav13
msrivastav13 / wordcloud.html
Created June 14, 2019 23:24
wordcloud lwc demo
<template>
<lightning-card title="Word Cloud Demo">
<canvas class="my_canvas" lwc:dom="manual"></canvas>
</lightning-card>
</template>
@msrivastav13
msrivastav13 / retrieveDXSource.sh
Created November 4, 2018 00:33
Retrieves the source in DX format from the unmanaged package
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: retrieveDXSource.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
if [ $# -lt 1 ]
then
echo Usage: deploypkg.sh orgalias
exit
fi
## Create a temp directory for mdapi
mkdir ./mdapipkg
sfdx force:source:convert -r ./force-app -d ./mdapi
@msrivastav13
msrivastav13 / generatepkgXML.sh
Created October 12, 2018 04:18
Generates package.xml from the Unmanaged container/Managed Package or Changesets
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: generatepkgXML.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container