Sunday, 2 June 2019

Salesforce DEV 401

triggers disable in production :
=================================
 we cannot disable triggers in production (triggers are not editable once deployed).

solution 1 :

using Force.com IDE/change Sets,Inactive/disable trigger and deploy to production.

solution 2 :

1. create configuration ( Custom Settings/Custom Metadata Types) to maintain the flag for each trigger execution.
2. Execute the trigger logic based on the above flag selection.

Note : custom settings aren't automatically transferred between sandboxes and production, so make sure you
include them in both places or your code will break.

purpose of Test.startTest() and Test.stopTest() :
=================================================
The code before Test.startTest() and after Test.stopTest() have new set of
Salesforce Governor Limits and code between Test.startTest() and Test.stopTest()
have new set of Salesforce Governor Limits.

ex :
@isTest
public class TestClass{

 @isTest
 static void test(){
 /*
   Declare the variables ,Fetch the required records,create and update
   sample records
 */
   
  Test.startTest();
   /*
     call the controller for code coverage
   */
   Test.stopTest();
   }
}

Exception Handling in Triggers :
===================================
In salesforce you can use addError method over an sObject or over an sObject field.

trigger AccountTrigger on Account (after update){
      for(Account acct : Trigger.new){
     acct.addError('Error added to account on trigger);
}
}

1.DMLException
2.ListException
3.NullPointerException
4.QueryException
5.sObjectException


object - oriented programs :
============================
1.Inheritance : This is the ability to extend an existing class to add a new functionality.
2. Polymorphism : This is the ability to perform different actions by calling the same method.
3. Abstraction : This is the ability to hide complex implementation.
4. Encapsulation : This is the ability to bind data attributes and behavior together.

Note :
======
To use inheritance in Apex, we need to use the "Virtual" or
"abstract" keywords in the base class and methods.


Use Visualforce Page in Lightning experience(LEX):
=======================================

1. use visualforce in Lightning Tab,Page layout, custom action, standard action
2.Styling Visualforce like Lightning <apex lightningStylesheets="true"/>
3.Using Lightning out to bring lightning into visualforce

1.Using App launcher to run a Visualforce page.
2.Adding Visualforce page in Lightning App Builder.
3.Display a visualforce page within a Standard Page Layout
4.Display visualforce page using custom buttons and links
5.Display visualforce page by Overriding Standard buttons or links.

Sandbox Types :
===============
1.Developer sandbox
2.Developer pro sandbox
3.Partial copy sandbox
4.Full Sandbox

Debug logs :
==============

A Trace Flag includes,

1. debug level
2. a start time
3. an end time
4. a log type

log category :
The type of information logged, such as information from Apex or
work flow rules.
log level
Event type

Development Tools :
======================
1.Developer Edition Environment
2.Scratch orgs
3. Salesforce Extension for vs code
4. Salesforce CLI
5.Developer console
6.Ant Migration Tools
7.Salesforce Lightning Inspector
8.Workbench

deployment tools :
=====================
1.Change sets :

Change sets are the simplest way of doing deployments
which uses point and click tool to migrate metadata
instead of using xml files or scripts.it works between
sandbox and production only.

2. Force.com Migration Tool - ANT/Java based :

3.Eclipse with Force.com IDE

4.Salesforce Package

Sandbox Types and Templates :
==============================
Sandbox Template :

Sandbox data templates allow you to pick specific objects
and data to copy to your partial or full sandbox,so you can
control the size and content of each sandbox.Sandbox data templates
are only available for use with partial or full sandbox.

Sandbox Types :
1. Developer
  A developer sandbox includes a copy of your production org's configuration (metadata).

   Refresh Interval : 1 day
   Storage Limit : Data storage : 200 MB,File storage : 200 MB
   what's copied : metadata only
   Sandbox Template : Not available
2. Developer pro
   Refresh Interval : 1 day
   Storage Limit : Data storage : 1 GB,File storage : 1 GB
   what's copied : metadata only
   Sandbox Template : Not available
3. Partial copy
   Refresh Interval : 5 day
   Storage Limit : Data storage : 5 GB,File storage : 5 GB
   what's copied : metadata and Sample data
   Sandbox Template : Required
4. Full copy

   Refresh Interval : 29 day
   Storage Limit : Same as your production org
   what's copied : metadata and all data
   Sandbox Template : available

No comments:

Post a Comment