Skip to content

Instantly share code, notes, and snippets.

@Rahman123
Rahman123 / PostLeads.md
Created November 10, 2022 06:06 — forked from johndturn/PostLeads.md
Post Leads to SFDC via JavaScript Fetch API and a Web-to-Lead form.

Post Leads to SFDC via JS Fetch API & Web-to-Lead

When working with Web-to-Lead forms, you might run into a situation where you'd like to integrate the form with your frontend framework (React, Vue, Angular, etc...). This can be accomplished quite easily using whatever HTTP library you're most comfortable with.

To demonstrate this, let's take a look at an example Web-to-Lead form, and the JavaScript required to post Leads to a SFDC org.

Example Form

<html lang="en">
@Rahman123
Rahman123 / fileSelectorStyle.css
Created August 6, 2022 02:55 — forked from MarioSalesforce/fileSelectorStyle.css
Gists for article Lightning File Upload on Medium
.file-selector-large ,
.file-selector-large .slds-file-selector__dropzone,
.file-selector-large .slds-file-selector__dropzone slot {
width: 100%;
}
.file-selector-large .slds-file-selector__dropzone slot {
padding: 14px;
}
@Rahman123
Rahman123 / SOQL Queries.sql
Created June 17, 2022 07:32 — forked from sholloway/SOQL Queries.sql
Useful SOQL queries for exploring a Salesforce org.
--------------------------------------------------------------------
-- Queries related to distribution of metadata.
-- Find the number of users per profile.
SELECT count(id), Profile.name
FROM User
WHERE User.IsActive = true
GROUP BY Profile.name
-- Find the distribution of Apex classes per namespace.
select count(id), NameSpacePrefix
@Rahman123
Rahman123 / tasks.json
Created May 5, 2022 17:14 — forked from msrivastav13/tasks.json
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",
@Rahman123
Rahman123 / AccountHandlerSetActivityDateOnSelf.cls
Created October 28, 2021 05:40 — forked from LawrenceLoz/AccountHandlerSetActivityDateOnSelf.cls
Trigger and handler class examples - Nebula Core
public with sharing class AccountHandlerSetActivityDateOnSelf implements BeforeInsert, BeforeUpdate {
public void handleBeforeInsert(List<Account> newList) {
setLastAccountTreeActivity(newList);
}
public void handleBeforeUpdate(List<Account> oldList, List<Account> newList) {
setLastAccountTreeActivity(newList);
}
@Rahman123
Rahman123 / AccountHandlerSetActivityDateOnSelf.cls
Created October 28, 2021 05:40 — forked from LawrenceLoz/AccountHandlerSetActivityDateOnSelf.cls
Trigger and handler class examples - Apex Trigger Actions
public with sharing class AccountHandlerSetActivityDateOnSelf implements TriggerAction.BeforeInsert, TriggerAction.BeforeUpdate {
public void beforeInsert(List<Account> newList) {
setLastAccountTreeActivity(newList);
}
public void beforeUpdate(List<Account> newList, List<Account> oldList) {
setLastAccountTreeActivity(newList);
}
@Rahman123
Rahman123 / jsInCss.css
Created September 26, 2021 05:34 — forked from adityanaag3/jsInCss.css
Style LWC by assigning the value of a JS Public Property to a CSS Custom Property
lightning-card{
--my-color: black;
}
div{
padding: 0.5rem;
margin-bottom: 0.5rem;
}
.myClass {
@Rahman123
Rahman123 / LightningRecordEditForm.xml
Created April 18, 2021 07:12 — forked from sfcure/LightningRecordEditForm.xml
This is a working example of rendering Lightning:RecordEditForm dynamically as per object's page layout
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="LightningRecordEditFormController">
<aura:attribute name="disabled" type="Boolean" default="false" />
<aura:attribute name="layoutSections" type="List" />
<aura:attribute name="saved" type="Boolean" default="false" />
<aura:attribute name="showSpinner" type="Boolean" default="true" />
<aura:attribute name="fieldName" type="String" default="StageName" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<lightning:card title="">
@Rahman123
Rahman123 / pay_netsuite_invoice_with_stripe.rb
Created December 23, 2020 05:44 — forked from iloveitaly/pay_netsuite_invoice_with_stripe.rb
Example of using Stripe to pay a NetSuite invoice using http://SuiteSync.io
# Michael Bianco <mike@suitesync.io>
# Link: https://gist.github.com/iloveitaly/4d85803709ef9bf18149cfdc9fe9eb9d
# Description: Use Stripe to pay a NetSuite Invoice by specifying an invoice ID
require 'stripe'
# Replace this test mode key and run this example on your account
Stripe.api_key = ENV['STRIPE_KEY']
# Create a card token to be associated with a customer. This is normally done
@Rahman123
Rahman123 / ExampleCallback.js
Created July 24, 2020 08:33 — forked from mshanemc/ExampleCallback.js
Example of Lightning Components for handling Apex Callback Errors
action.setCallback(this, function(a){
if (a.getState() === "SUCCESS") {
//happy path stuff
} else if (a.getState() === "ERROR"){
var appEvent = $A.get("e.c:handleCallbackError");
appEvent.setParams({
"errors" : a.getError(),
"errorComponentName" : "someUniqueName"
});
appEvent.fire();