/Token

Primary LanguageApex

Salesforce Org

Table of Contents

Apex Best Practices

  • Only use primitives in sets.

  • Best places to use sets:

    • Prevent and detect duplicate IDs
    • Use in queries (with in and not in term) to filter resutls
    • Convert a set to a list by passing it as a parameter to a list constructor
    • Add all items in a list to a set using the set addAll method
  • Custom settings are ideal for application configuration data

Apex Code Analysis Tool

Apex String Class

Apex System Class

Apex Unit Tests

Unit tests are class methods that verify whether a particular piece of code is working properly. Unit test methods:

  • take no arguments,
  • commit no data to the database,
  • send no emails, and
  • are flagged with the testMethod keyword or
  • the @isTest annotation in the method definition. Also,
  • test methods must be defined in test classes, that is, classes annotated with @isTest.

Field History Tracking in Test Methods

Field history tracking records (such as AccountHistory) can't be created in test methods because they require other sObject records to be committed first (for example, Account).

Run Unit Tests

  • Some or all methods in a specific class
  • Some or all methods in a set of classes
  • A predefined suite of classes, known as a test suite
  • All unit tests in your org

Aura

Validating Fields

LightningSelfRegisterController

  • LightningSelfRegisterControllerTest.testSelfRegisterWithCreatedAccount

  • LightningSelfRegisterControllerTest.testGetNonEmptyExtraFields

  • LightningSelfRegisterControllerTest.testGetNullExtraFields

  • LightningSelfRegisterControllerTest.testSelfRegisterWithProperCredentials

  • LightningSelfRegisterControllerTest.testSiteAsContainerEnabled

  • LightningSelfRegisterControllerTest.testSelfRegisterWithCreatedAccount

  • LightningSelfRegisterControllerTest.testSelfRegistration

  • LightningSelfRegisterControllerTest.testGetExtraFieldsInSelfRegistration

  • LightningSelfRegisterControllerTest.testIsValidPassword

  • {!v.attributeName} - points to attribute name in aura:attribute tag.

  • event.getSource() - source is the thing that generated the event.

    • gets us a reference to the specific lightning:button that was clicked.

Community Cloud

Git

Pull requests: A pull request is a package of commits you’re requesting to be merged into the default branch. A pull request provides a place to discuss the changes you’re proposing and invite other team members to comment and complete code reviews. Pull requests also help you see the result of automated tests and many other cool integrations.

  • network commands in Git: git clone, git fetch, git pull, and git push.
  • gpg cheatsheet
  • Link your local Git repository with your remote GitHub repository. Make sure to replace YOUR_GITHUB_USERNAME with your actual GitHub username: git remote add origin https://github.com/YOUR_GITHUB_USERNAME/sfdx-project.git
  • Push local commits (your file revisions) to the master branch on GitHub: git push origin master
  • switch to the Git branch named master: git checkout master
  • Pull remote commits from the master branch on GitHub: git pull origin master
  • git rev-parse --abbrev-ref HEAD - show current branch
  • Git Commands

JavaScript

Notes

  • Application owner object - coinbase inc questionnaire (applying in us)
  • Rules engine - sync up with Josh
  • Placeholder for Coinbase in or Coinbase UK

LDS

Lightning Data Service (LDS) serves as the data layer for Lightning.

  • LDS is the Lightning Components counterpart to the Visualforce standard controller, providing access to the data displayed on a page.
  • Without LDS, each component within an app makes independent calls to the server to perform CRUD operations on a record, even if all components in the app pull from the same record data.
  • Each server call reduces performance.
  • These independent server calls can also lead to inconsistencies, creating situations where a server call refreshes one component, leaving other components out of date.
  • Lightning Data Service identifies and eliminates requests that involve the same record data, sending a single shared data request that updates all relevant components.
  • It provides a way to cache data to work offline in case the user gets disconnected, intelligently syncing the data once the connection is restored. Lightning Data Service provides reusable Aura components that:
  • Minimize XMLHttpRequests (XHRs)
  • Fetch records once, reducing network transfers, app server load, and database server load
  • Cache record data on the client, separate from component metadata
  • Share record data across components
  • Enable progressive record loading, caching, and merging more fields and layouts into the cache
  • Enable proactive cache population
  • Promote consistency by using only one instance of the record data across multiple components
  • Create notifications when record data changes

OOP

Every class has three components to it: [1] Attributes, [2] Methods, and [3] Constructors.

  1. Attributes - Attributes are the variables that describe your class. Your class’s attributes can be any data type, collection, or even class! Think of attributes to be just like custom fields, except they exist on your class instead of a Salesforce object. Classes referenced would have to already exist for the class to save!
  2. Methods - Methods are the actions available to objects of your class. You define the logic inside each method, what inputs are required (if any), and what value is returned (if any). Here’s the general template:
public ReturnType MethodName(Input1Type Input1Variable) {
  // Method logic goes here
}
  • ReturnType is the data type, collection, or class that’s returned when your method is called.
  • If you don’t want your method to return anything, use void.
  • MethodName is whatever you want to name your method
  • Input1Type is the data type, collection, or class that represents your first accepted input, and Input1Variable is the variable name you’re assigning it to so you can reference it in your method’s logic. You can add more inputs to your method by separating them with commas.

Rule Engine

Common uses:

  • Custom Object Assignment - lets you assign any record in Salesforce at any time with your own logic. Build custom rules sets to support complex processes.
  • User Management - Ideal for organizations with Communities, an automated way to add users to Public and Chatter groups, and allows you to manage the creation of new groups.
  • Topic Assignements - With flexible customization, this BREeze capability makes it easy for teams to gain all the advantages offered by Salesforce’s Topics functionality – without writing code.
  • Complex Record Assignment - consolidate multiple workflows into a single rules set that’s simple to manage – and doesn’t eat into your workflow rule allocation.
  • SFDCRules – Simple yet powerful Rule Engine for Salesforce

Sample Architecture

  • Rule-Master object
  • Rule Criteria - Child object
  • Rule Result - Child object.
  • To update one record, trigger will call this method and loop through all the rules, rule criteria and update rule result value on the field.

Onboarding Application

Login

https://onb-coinbase.cs97.force.com/onboarding/s/

Self-Register

https://onb-coinbase.cs97.force.com/onboarding/s/login/SelfRegister

Register Entity Details

https://onb-coinbase.cs97.force.com/onboarding/s/RegisterEntityDetails?b=null

Open API

Pages:

  • Check Password
  • Create Record
  • Error
  • Forgot Password
  • Home
  • HomeDashboard
  • Login
  • Login Error
  • Onboarding Application Form
  • Onboarding Application Owners
  • Register
  • Register Entity Details
  • Search

Controllers

  • lightning self reg class and the register entity details class
  • onb_ApplicationFormController
  • registerEntityDEtails

Salesforce Community

SFDC Rule Engine

Version Control System - VCS

Source of Truth

Links

Courses