Jan 6, 2021

Refer to the Prior Values of the Record That Triggered Your Flow

 Refer to the Prior Values of the Record That Triggered Your Flow


  • We can compare new value , old value by using ISCHANGED  in Process Builder 
  • We can do same thing in Workflow as well
  • but we can't do this comparison in Salesforce Flow
In Spring 21 , we can do this comparison by using {!$Record__Prior}


Reference : https://help.salesforce.com/articleView?id=release-notes.rn_forcecom_flow_fbuilder_prior_values_flow.htm&type=5&release=230 

Jan 4, 2021

Why Use the Aura Components Programming Model?

Aura Components Programming Model


Benefits:

Out-of-the-box Components

      Comes with an out-of-the-box set of components to kick start building apps. You don't have to spend your time optimising your apps for different devices as the components take care of that for you.


Rich Component Ecosystem
Create business-ready components and make them available in the Salesforce app, Lightning Experience, and Communities. Salesforce app users access your components via the navigation menu. Customize Lightning Experience or Communities using drag-and-drop components on a Lightning Page in the Lightning App Builder or using Experience Builder. Additional components are available for your org in the AppExchange. Similarly, you can publish your components and share them with other users.
Fast Development
Empowers teams to work faster with out-of-the-box components that function seamlessly with desktop and mobile devices. Building an app with components facilitates parallel design, improving overall development efficiency.
Components are encapsulated and their internals stay private, while their public shape is visible to consumers of the component. This strong separation gives component authors freedom to change the internal implementation details and insulates component consumers from those changes.
Device-aware and Cross Browser Compatibility
Apps use responsive design and support the latest in browser technology such as HTML5, CSS3, and touch events.

Decorators

 Decorators

Decorators

Decorators are often used in JavaScript to modify the behavior of a property or function.
@api: Marks a field as public. Public properties define the API for a component. An owner component that uses the component in its HTML markup can access the component’s public properties.
All public properties are reactive, which means that the framework observes the property for changes. When the property’s value changes, the framework reacts and rerenders the component.
@track: Tells the framework to observe changes to the properties of an object or to the elements of an array. If a change occurs, the framework rerenders the component.
Prior to Spring ’20, you had to use @track to mark fields (also known as private properties) as reactive. You’re no longer required to do that. Use @track only to tell the framework to observe changes to the properties of an object or to the elements of an array. Some legacy examples may still use @track where it isn’t needed, but that’s OK because using the decorator doesn’t change the functionality or break the code. For more information, see this release note.
@wire: Gives you an easy way to get and bind data from a Salesforce org.

SOQL - Salesforce Object Query Language

SOQL 


 Salesforce’s back-end database uses Oracle

  • SOQL: Salesforce Object Query Language
  • SOQL is used only to perform queries with the SELECT statement. SOQL has no equivalent INSERT, UPDATE, and DELETE statements
  • Data manipulation is handled using a set of methods known as DML (Data Manipulation Language)
  • One big difference you’ll notice right away is that SOQL has no such thing as SELECT *. Because SOQL returns Salesforce data, and that data lives in a multi-tenanted environment where everyone is kind of "sharing the database,” a wildcard character like * is asking for trouble



SOQL has two basic relationship query types that you need to remember:
  • Child-to-parent
  • Parent-to-children

Child-to-parent

  • SELECT c.FirstName, c.LastName, a.Name FROM Account a RIGHT JOIN Contact c ON (c.AccountId = a.Id)

 Parent-to-Children

  • SELECT Name, (Select FirstName, LastName FROM Contacts) FROM Account

SOQL Aggregate Functions

FunctionDescription
AVG()Returns the average value of a numeric field.
COUNT() and
COUNT(fieldName) and
 COUNT_DISTINCT()
Returns the number of rows matching the query criteria.
MIN()Returns the minimum value of a field.
MAX()Returns the maximum value of a field.
SUM()Returns the total sum of a numeric field.

Best Practices:

  • use Filters in SOQL ( Where Clause)

  • use indexed Fields in Where Clause

  • Id
  • Name
  • OwnerId
  • CreatedDate
  • SystemModStamp
  • RecordType
  • Master-Detail
  • Lookup Fields
  • Unique Fields
  • External ID Fields

  • avoid these things

  • Querying for null rows
    • SELECT Id, Name FROM Account WHERE Custom_Field__c = null
  • Negative filter operators
    • SELECT CaseNumber FROM Case WHERE Status !=New
  • Leading wildcards
    • SELECT Id, LastName, FirstName FROM Contact WHERE LastName LIKE ‘%smi%
  • Text fields with comparison operators
    • SELECT AccountId, Amount FROM Opportunity WHERE Order_Number__c > 10

Lightning Flow

 

Lightning Flow


  • Lightning Flow is the name of the product.
    • It is a Salesforce product that encompasses building, managing, and running flows and processes.
  • Process Builder and Flow Builder are the names of the tools.
  • Use Process Builder to make processes; use Flow Builder to make flows.
Process Builder
Process Builder is a point-and-click tool that lets you easily automate if/then business processes and see a graphical representation of your process as you build.

Use Process Builder when you need to start a behind-the-scenes business process automatically. Processes can start when:
  • A record is created
  • A record is updated
  • A platform event occurs
Actions: What the Process Should Do
When a criteria node evaluates to true, the process executes the associated actions or waits to execute them at a scheduled time.
  • Each immediate action is executed as soon as the criteria evaluates to true.
  • Each scheduled action is executed at the specified time, such as 10 days before the record’s close date or 2 days from now. 

Process Builder can:
  • Create records.
  • Update the record that started the process or any related record.
  • Submit that record for approval.
  • Update one or more related records.
  • Send emails using a specified email template.
  • Post to a Chatter feed.
  • Invoke auto-launched flow
  • Invoke Apex class
Process Builder can’t:
  • Post to a community feed.
  • Submit a related record for approval.
  • Delete records(Without Apex)
  • Create a bunch of records and associate them with each other.
  • Perform complex logic.

Flow Builder

Use Flow Builder to:
  • Automate a guided visual experience.
  • Add more functionality for a behind-the-scenes process than is available in Process Builder. Use Flow Builder to build the more complex functionality. Then call the resulting flow from the process.
  • Start a behind-the-scenes business process when a user clicks something, like a button.
For example, when an opportunity is won, your company wants a renewal opportunity to be created automatically. As you see later in this module, you can build parts of that use case as a process, but the rest has to be built in a flow.

screen flows : Needs user Inputs to business Automation
autolaunched flows : Run in the background like a process.Can’t have screens

In Process Builder, you can’t grab the ID of the created record and use it elsewhere. Luckily, you can do that in a flow.

Apex

Use Apex when you need more functionality than is available in Process Builder or Flow Builder. Build the more complex functionality as invocable Apex methods. Then call the resulting Apex as an Apex action in the process or as an Apex action element in the flow.

Approvals isn’t included in Lightning Flow, but it offers a declarative way to automate something that Lightning Flow doesn’t cover