SF Interview Question Sheet Last
SF Interview Question Sheet Last
Salesforce fundamentals..............................................................................................................4
Objects - Fields............................................................................................................................5
Profile - Role................................................................................................................................6
What is a profile?.....................................................................................................................................................6
What is Role ?.......................................................................................................................................................... 6
Difference between Role and Profile?......................................................................................................................6
What is a dependent picklist?..................................................................................................................................7
What is Page Layout and Record Types?..................................................................................................................7
How to freeze users in salesforce.com?...................................................................................................................7
Which fields cannot be added as a custom Index?...................................................................................................7
Security.......................................................................................................................................7
What are different Levels of data access in Salesforce?...........................................................................................7
What is Organization-wide defaults?.......................................................................................................................8
Relationships.............................................................................................................................10
What are the different types of Relationships in SFDC?What are they?.................................................................10
What is a “Look-up Relationship”?.........................................................................................................................11
What is “Master-Detail Relationship”?...................................................................................................................11
What is Roll-up summary?.....................................................................................................................................11
Define various characters of Roll-up Summary Field?............................................................................................11
List out the functions of Roll-up Summary field ?..................................................................................................11
What is Many-Many Relationship in Salesforce ?...................................................................................................11
Can we have Roll up Summary fields in case of Parent-Child Relationships?.........................................................11
Is it possible to edit Roll up summary field value in a record?................................................................................11
Is it possible to create Roll up summary field on parent object ?...........................................................................11
What is Junction Object?.......................................................................................................................................11
Can we convert the look up relationship to Master Detail relationship? If so How can we convert?.....................11
Can we create Master Detail relationship on existing records?..............................................................................12
What happens to detail record when master record is deleted?...........................................................................12
What happens to child record when a master record is deleted in Look-up Relationship?....................................12
Workflow...................................................................................................................................13
What is Workflow?.................................................................................................................................................13
Different Workflow Components available in salesforce?......................................................................................13
What are the different workflow actions available in Salesforce?..........................................................................13
What is a Workflow Field Update?.........................................................................................................................13
What is Time-Dependent Workflow?.....................................................................................................................13
Is it possible to delete the workflow when the workflow is having any pending time dependent actions?...........14
What is the use of re-evaluate workflow?..............................................................................................................14
What are the Time-Dependent Workflow Limitations?..........................................................................................15
Trigger vs Workflow?..............................................................................................................................................15
PROCESS BUILDER...............................................................................................................15
Explain Recursion – Allow process to evaluate a record multiple times in a single save operation?......................16
Do you want to execute the actions only when specified changes are made to the record?.................................16
What should be the condition we need to specify in process builder to specify schedule actions?.......................16
Is it possible to edit the process once it is activated?.............................................................................................16
What can be done using Process Builder?..............................................................................................................16
Update all related case and Contacts with the same email of account whenever account email changed............16
Process Builder Vs Apex Trigger?............................................................................................................................16
How to call Future methods from Process Builder?...............................................................................................17
What are the things which we can not do with process builder in Salesforce?......................................................17
What kind of related records can we update using process builder in Salesforce?................................................17
Flow...................................................................................................................................................17
What is difference between screen flow and auto launched flow?........................................................................17
What is invocable method?....................................................................................................................................17
Difference between flow and process builder?......................................................................................................17
Can we change the data type of variable once we have created in lightning flow designer?.................................17
What are the ways in which flows can be launched?.............................................................................................17
Can we query process Builder / Flow.....................................................................................................................18
Developer Questions..................................................................................................................18
Trigger...............................................................................................................................................18
What is a Trigger?.................................................................................................................................................. 18
What are the various event on which a trigger can fire?........................................................................................18
What are the considerations while implementing the Triggers?............................................................................18
What are context variables in triggers?..................................................................................................................18
What are the considerations while implementing the Trigger Context Variables...................................................19
How is Trigger.New Different from Trigger.newMap?.............................................................................................20
How is Trigger.new different from Trigger.old?.......................................................................................................20
Can a trigger call a batch class?..............................................................................................................................20
Can a trigger make a call to Apex callout method?................................................................................................20
What will you do if a method inside apex class need to be executed only when it is getting called from trigger?.20
What is the use of trigger.isexecuting?...................................................................................................................20
Is the id of record changes if we undelete a deleted record?.................................................................................20
What is a Recursive Trigger?..................................................................................................................................20
How to avoid Recursive Trigger?............................................................................................................................20
What do you mean by the bulkifying trigger?........................................................................................................20
What is difference between Triggers and Workflow rules?....................................................................................21
What are limitations of Workflows overcome by Triggers in Salesforce.................................................................21
Difference between Validation rules and Triggers?................................................................................................21
Why Process Builder and how is it differ from trigger?..........................................................................................21
What are the best practices for Triggers?...............................................................................................................22
Governor Limits......................................................................................................................................................22
Best practices to avoid Governor Limits.................................................................................................................22
What is the difference between database.insert and insert?.................................................................................23
Can you explain the order of execution in Triggers?...............................................................................................23
Batch Classes.....................................................................................................................................24
How many active batches(running parallel) can be allowed at a time?..................................................................24
Why to use Batch class as we already having data loader to process the bulk data...............................................24
How many times the execute method will be executed to process the 1234 records...........................................24
What is the maximum size of a batch that we can set up ?....................................................................................25
Can we call future method in batch class?.............................................................................................................26
What is the difference between database.batchable & database.batchablecontext bc?.......................................26
What if you change the name of Execute method to Execute1 in the batch class? Will the batch job still run?....26
Is there a way in which I can call a future method from a batch Job?....................................................................27
Future and Queueable APEX............................................................................................................27
Why Future?.......................................................................................................................................................... 27
When future is used?.............................................................................................................................................27
Why Queueable Apex?...........................................................................................................................................27
When queueable is used?......................................................................................................................................27
Differences between Future and Queueable Apex:................................................................................................27
Security in Apex (System/User Mode, With/Without Sharing, Access)..................................................................28
With Sharing vs. Without Sharing..........................................................................................................................28
Test Classes........................................................................................................................................28
Test Types...............................................................................................................................................................28
How is code coverage calculated?..........................................................................................................................28
Which classes are excluded from code coverage calculation?................................................................................29
How to retrieve code coverage information?.........................................................................................................29
Unit Test Best Practices..........................................................................................................................................29
Test classes best practices......................................................................................................................................29
Why to create separate class for testing purpose?.................................................................................................30
What are the considerations of using isTest annotation?.......................................................................................30
What are the things to remember when we use @testSetup method?.................................................................30
What is the difference between testMethod and @isTest?...................................................................................30
@testVisible annotation?.......................................................................................................................................30
How is a class defined as a test class ?...................................................................................................................30
Exception Handling................................................................................................................................................ 30
Aura..........................................................................................................................................31
Where to use Lightning Components?...................................................................................................................31
What are the components bundles used in the Lightning component?.................................................................31
Can Lightning be viewed as an MVC(model view controller) framework?.............................................................32
Which Lightning components parts are server-side and which ones are client-side?............................................32
Is it possible to include a Lightning component into another?...............................................................................32
What are Aura Components? Why we use Aura: Namespace in the code?...........................................................32
Are there any CSS (styles) provided by Salesforce.com for Supported Lightning Components?............................32
Is it possible to integrate lightning components with a framework such as Angular?............................................32
Are there any options for Lightning Record Page Assignment?..............................................................................32
How to create a custom Lightning Record Page?...................................................................................................32
What are the attributes? What are the parameters required?...............................................................................33
Which interface to use if you want your component to be available for all pages?...............................................33
Which interface can be used to get the id of the record from the record Detail page?..........................................33
What are the type of events into Salesforce Lightning component........................................................................33
What is the basic difference between Application Event and Component Event...................................................33
What are the propagation phases of Component Events?.....................................................................................33
What are the propagation phases of Application Events?......................................................................................33
What is the key difference between Application and Component Events?............................................................33
In which cases should you use Application Events and when are Component Events preferable?.........................33
Data Binding:..........................................................................................................................................................33
LWC...........................................................................................................................................34
LWC data binding................................................................................................................................................... 34
LWC Life Cycle of Events.........................................................................................................................................34
Decorators on LWC or Reactive Operators.............................................................................................................34
Lightning message service......................................................................................................................................35
Lightning Web Components Best practices............................................................................................................35
What are lifecycle hooks in LWC ?..........................................................................................................................36
Communication between child-parent:..................................................................................................................37
What do you mean by cacheable = true annotations ?.........................................................................................37
What is LMS (Lightning Message Service)?............................................................................................................37
LWC vs Aura........................................................................................................................................................... 37
Salesforce fundamentals
“Cloud Computing is a new trend in IT development, deployment, Delivery module of business Products, Services that are provided over the
internet that are been used by the real time User“
It’s a concept that where people or companies can carry out their daily processes or development, deployment processes or meet their server
needs with using some outer source.
Error: Reference source not found
Expand CRM and briefly explain about CRM ?
Full form for CRM or Acronym for CRM is “Customer Relationship Management “. We can understand from the full form where CRM is an
application used to automate Sales and marketing functions by a using a Software called CRM Software . BY using CRM Software every
Company / Organization plans to (make their inner processes about customer data they have more easy and more sustainable )increase their
revenues and profits. This strategy of increasing revenue is done mainly by attracting Customers, clients, Sales etc.
Error: Reference source not found
List some CRM Software’s?
We have number of CRM softwares which are provided by top CRM companies some of them are listed below depending upon their present
market.
Salesforce CRM.
Microsoft Dynamics CRM.
Oracle CRM.
SAP CRM.
Sage CRM.
NetSuite CRM.
Oracle CRM on Demand.
Oracle Sales Cloud(Fusion CRM).
SugarCRM.
Nimble
Error: Reference source not found
What are the Advantages of Cloud Computing?
Cloud computing has made tremendous growth in processing power, reliability of the Internet and the great increase in broadband speeds.
It makes tremendous sense to make use of the centralized server of the provider of cloud computing services as not only does it reduce the costs
by a great extent by making redundant the need to buy several software licenses, it also eliminates the huge costs required by an organization to
maintain and upgrade existing software.
What is the definition of CRM?
“Cloud Computing definition given by NIST (US National Institute of Standards and Technology) : Cloud Computing is a model for
enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources that can be rapidly
provisioned and released with minimal management effort or service provider interaction“.
Error: Reference source not found
What are deployment modes of cloud computing?
Cloud computing services can be provided in four different deployment modes depending on size and structure of an organization. Four
deployment modes of cloud computing are
Public Cloud.
Private Cloud.
Hybrid Cloud and
Community Cloud.
What is SaaS?
SaaS means Software as a Service. Through this Services all the software’s are distributes over the cloud. By using SaaS no need to install any
software all software’s are readily available over the internet .
Error: Reference source not found
What is IaaS?
Full form IaaS is “Infrastructure as a Service”. Here in IaaS the cloud service providers will provides infrastructure like servers, hosting services
and storage. Servers and storage’s are the basic services provide by Cloud Service Providers.
Objects - Fields
Different types of object in Salesforce.com? And why they called so?
In Salesforce.com we have two types of objects. They are
Standard objects.
Custom Objects.
Standard Objects :- Standard objects are called so because they are created and provided by Salesforce.com.
Custom Objects :- Custom objects are those which are created by an User in salesforce.com.
Error: Reference source not found
What is an object in Salesforce?
An Objects is represented as a database table which stores organization data . Objects consists of set of fields and we store data against that
field. To view data Salesforce provided TABS.
To create custom fields go to Setup=>Build=>Create=>Object.
What is TAB in Salesforce?
Salesforce.com provides list of tabs and are placed in Tab menu. To access data of an objects Tabs are used. Tabs in Salesforce are three types
they are.
Custom Tabs.
*Visualforce Tabs.
*Web Tabs.
List examples of custom field types?
Some of the custom field types are date field, Date/Time field, Currency field, Checkbox field, Number field, Text field, Pick list field, Email
field, percent fields, phone field, Url field and many more.
Error: Reference source not found
What are the Standard and Custom Fields in Salesforce?
Standard fields for custom objects stores the information about created by, modified by, currency, Name, owner and Division. These are the
standard fields in Salesforce.com.
Custom field for custom objects store unique data or information of an organization.
How many custom fields can I created in an object?
In Unlimited edition we can create up to 500 fields per object. In professional edition we can create up to 100 custom fields per object.
Error: Reference source not found
Profile - Role
What is a profile?
Profiles are those which defines user’s to perform different functions like settings and permissions in salesforce. It is another way to restrict or
control access to a particular record.
Profile are of two types.
Standard Profile. Profiles created by force.com are called Standard Profiles.
Custom Profile. Profiles created by user are called Custom Profiles.
Error: Reference source not found
What is Role ?
Role Hierarchy settings make the managers and subordinates to edit, and view the records. The users in the Hierarchy can be able to view,
edit and report all the data shared.
To create roles in salesforce go to setup=>Administer=>Manage Users=> Roles.
Security
What are different Levels of data access in Salesforce?
Organization level security
For your whole org, you can maintain a list of authorized users, set password policies, and limit logins to certain hours and locations.
Object level security
Access to object-level data is the simplest thing to control. By setting permissions on a particular type of object, you can prevent a group of users
from creating, viewing, editing, or deleting any records of that object. For example, you can use object permissions to ensure that interviewers
can view positions and job applications but not edit or delete them.
Field level security
You can restrict access to certain fields, even if a user has access to the object. For example, you can make the salary field in a position object
invisible to interviewers but visible to hiring managers and recruiters.
Record level security
You can allow particular users to view an object, but then restrict the individual object records they’re allowed to see. For example, an
interviewer can see and edit her own reviews, but not the reviews of other interviewers. You can manage record-level access in these four ways.
Organization-wide defaults
Role hierarchies
Sharing rules
Manual sharing
Error: Reference source not found
Error: Reference source not found
Workflow
What is Workflow?
Salesforce Workflow is a business logic that evaluates the records as they are created, updated in an object to apply automated process
like Assigning Tasks, Emails, Field Update and outbound message sending.
Different Workflow Components available in salesforce?
In salesforce.com. workflows consists of 5 components they are.
1. Workflow rules.
2. Workflow tasks.
3. Workflow Email alerts.
4. Workflow field updates.
5. Workflow Outbound messages
What are the different workflow actions available in Salesforce?
1. Tasks.
2. Email alerts.
3. field updates.
4. Outbound messages
Error: Reference source not found
What is a Workflow Task?
Workflow tasks in salesforce are used to assigns a task to users. Using tasks we can specify the Subject, Status, Priority, and Due Date of the
task. Tasks are workflow & approval actions that are triggered by workflow rules or approval processes.
What is a Workflow Alert?
Email alert is one of the action used in workflow and approval. They are used to generate email template by a workflow rule or approval process
and sent to destination recipients. We can send workflow email alerts to users, contacts having a valid email address.
Error: Reference source not found
What is a Workflow Field Update?
Field updates in workflow and approval processes specifies the field that we want updated and inserting the new value for it. Depending on the
field type, we can choose the following options. They are apply a specific value, make the value blank, or calculate a value based on a formula
you create.
What is Time-Dependent Workflow?
Time dependent workflows are not executed independently. Time dependent workflows remain constant in the workflow queue as long as the
workflow rule criteria is valid.
Time-Dependent Workflow – Considerations?
When defining time dependent workflows in salesforce we have to use standard and custom date and date/time fields defined for the object.
We have to specify time using days and hours.
Also add actions to existing time triggers.
Error: Reference source not found
Limitations of Time-dependent workflow?
When defining time dependent workflows in salesforce we have to use standard and custom date and date/time fields defined for the object.
We have to specify time using days and hours.
Also add actions to existing time triggers.
In which criteria of a workflow – “time dependent workflow action” cannot be created ?
Created, and every time it’s edited.
When you can’t add Time dependent action in Workflow rule?
Time dependent actions in workflow rules can not be added when the following actions takes place.
When workflow rule is active.
When workflow rule is deactivated and has pending actions in the queue.
When the workflow rule criteria of a record is set to: created, and every time it’s edited.
When the workflow rule is included in a package.
Error: Reference source not found
We have a “Time Based Workflow” and there is Action scheduled to be executed. If we Deactivate the workflow, Scheduled actions will
be removed from queue or not?
Even after deactivating the workflow, its action will not be removed. It’s still active in queue.
We have “Time Based Workflow” and there is action scheduled to be executed. Can we delete that workflow?
It is not possible to delete the workflow when the workflow is having any pending time dependent actions.
How to clear the Time based workflow action queue?
We can clear time based workflow action queue in two ways they are
1. Make the criteria false.
2. Removing scheduled actions from the queue.
Error: Reference source not found
While creating workflow on Task, what difference observed on available actions?
While creating workflow on task we can not find “Send Email”action.
Suppose if a record meets workflow criteria for time based workflow action, the action goes in queue. Later, before the time based action is
triggered, the same record gets modified and the criteria previously met is changed and now it does not meet the workflow criteria. What
happens to the time based action placed in Queue?
Simply the time based workflow action is removed from workflow queue and will not get fired.
Error: Reference source not found
Whenever case is created send email to case owner. How to do that?
We can do it using workflow.
I have two workflow Rules and two fields F1 and F2.
When ever F1 is updated to value= 10, WF1 fires and updates F1 value to 20 and F2 value to 30
When ever F1 values= 20 there is another Workflow WF2 fires which will update F1 to 10 and F2 to 20
What will be the outcome of this Workflow rule.
• This scenario will cause recursive Workflow rule
• This will exhaust the governor limit and result in error
Is it possible to delete the workflow when the workflow is having any pending time dependent actions?
No
Error: Reference source not found
What is the use of re-evaluate workflow?
If the field update changes the field’s value, all workflow rules on the associated object are re-evaluated. Any workflow rules whose criteria are
met as a result of the field update will be triggered.
If any of the triggered workflow rules result in another field update that’s also enabled for workflow rule re-evaluation, a domino effect occurs,
and more workflow rules can be re-evaluated as a result of the newly-triggered field update. This cascade of workflow rule re-evaluation and
triggering can happen up to five times after the initial field update that started it.
Make sure that your workflow rules aren’t set up to create recursive loops. For example, if a field update for Rule1 triggers Rule2, and a field
update for Rule2 triggers Rule1, the recursive triggers may cause your organization to exceed its limit for workflow time triggers per hour.
Example if field A=10 => Change it to field B = 100
If field B=100 => Change field A=10
Only workflow rules on the same object as the initial field update will be re-evaluated and triggered.
Only workflow rules that didn’t fire before will be retriggered.
Cross-object workflow rules aren’t candidates for re-evaluation.
Cross-object field updates that cause a field value to change don’t trigger workflow rule re-evaluation on the associated object.
An approval process can specify a field update action that reevaluates workflow rules for the updated object. If, however, the re-evaluated
workflow rules include a cross-object field update, those cross-object field updates are ignored.
Time-dependent actions aren’t executed for a reevaluated workflow rule in the following situations:
The reevaluated workflow rule’s immediate actions cause the record to no longer meet the workflow rule criteria.
An Apex after trigger that is executed as a result of a workflow or approvals action causes the record to no longer meet the workflow rule
criteria.
Error: Reference source not found
How to avoid recursive workflow?
For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive
workflow rules.
If you don’t enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule we can avoid.
For example, suppose that for an opportunity record to meet the rule criteria, the opportunity probability must be greater than 50%. If you create
an opportunity with a probability of 75%, the workflow rule runs. If you edit that opportunity by changing the probability to 25%, the edit
doesn’t cause the rule to run. If you then edit that opportunity by changing the probability from 25% to 75%, the edit causes the rule to run. With
this last edit, the rule runs, because the record is changed from not meeting the rule criteria to meeting the rule criteria.
Error: Reference source not found
What is Cross-Object Field Updates?
For all custom objects and some standard objects, you can create actions where a change to a detail record updates a field on the related master
record.
For example, in a custom recruiting application, create a workflow rule that sets the status of an application (the master object) to “Closed” when
a candidate (the detail object) accepts the job. Or, for standard objects, create a rule to change the status of a case from “Awaiting Customer
Response“ to “In Progress” when a customer adds a case comment.
Error: Reference source not found
What happens if workflow rule has time trigger set to past?
If a workflow rule has a time trigger set for a time in the past, Salesforce queues the associated time-dependent actions to start executing within
one hour. For example, if a workflow rule on opportunities is configured to update a field 7 days before the close date, and you create an
opportunity record with the close date set to today, Salesforce starts to process the field update within an hour after you create the opportunity.
What happens if we change the rule criteria of time based workflow and updated rule don’t match the criteria?
Time-dependent actions remain in the workflow queue only as long as the workflow rule criteria are still valid. If a record no longer matches the
rule criteria, Salesforce removes the time-dependent actions queued for that record.
Error: Reference source not found
What are Limitations of Time Based workflow?
Time triggers don’t support minutes or seconds.
Time triggers can’t reference the following:
DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
Formula fields that include related-object merge fields.
Salesforce limits the number of time triggers an organization can execute per hour. If an organization exceeds the limits for its Edition,
Salesforce defers the execution of the additional time triggers to the next hour.
If time-based workflow actions exist in the queue, you can’t add or remove time triggers or edit trigger dates without deleting the actions first.
Because the deleted records can’t be restored, carefully consider the implications of editing the workflow rules before you proceed.
You also can’t add or remove time triggers if:
The workflow rule is active.
The workflow rule is deactivated, but has pending actions in the queue.
The workflow rule evaluation criteria is set to Evaluate the rule when a record is: created, and every time it’s edited.
The workflow rule is included in a package.
Error: Reference source not found
What are the Time-Dependent Workflow Limitations?
Time triggers don’t support minutes or seconds.
Time triggers can’t reference the following:
• DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
• Formula fields that include related-object merge fields.
When cannot you add or remove time trigger from workflow?
You can’t add or remove time triggers if:
• The workflow rule is active.
• The workflow rule is deactivated but has pending actions in the queue.
• The workflow rule evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
• The workflow rule is included in a package
Error: Reference source not found
We have Time Based Workflow and there is action scheduled to be executed. Can we delete that workflow?
If a workflow has any pending time dependent action, then we cannot delete the workflow.
How to clear the Time based workflow action queue?
1. Make criteria false for all those records.
2. Navigate to Set up -> Monitoring -> Time Based Workflow, search for scheduled actions and remove from queue.
When the Add Time Trigger button is unavailable?
The evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
The rule is activated.
The rule is deactivated but has pending actions in the workflow queue.
Error: Reference source not found
Trigger vs Workflow?
Salesforce Workflow:
It is an automated process that can shoot an action which is based on evaluation and rule criteria.
Performing DML operations in the workflow is not possible.
You can obtain a workflow over an object.
You can’t create a query from the database.
Salesforce Trigger:
It is a piece of code which is executed either before or after a record is updated or inserted.
More than 15 DML operations can be used in a single trigger.
More than 20 SOQLs can be used from the database in a trigger.
You can access triggers across an object and related to that object.
Limitations of Workflows That Triggers in Salesforce Overcome
Workflows cannot create or update a separate object.
You can’t reference certain fields when using workflows.
You will not have your workflow doing more than just field updates and emails.
Error: Reference source not found
PROCESS BUILDER
Points to consider when calling apex class from process builder?
Only Classes that have @InvocableMethod annotation will be listed for selection. Use this annotation at the method level.
The method should be static and public or global.
A class can only have one method which has this annotation.
Can’t use other annotations with @InvocableMethod annotation.
Invocable methods can have only one parameter. These methods can accept only a list of primitive data types or list-of-lists of the primitive data
types
Error: Reference source not found
Explain Recursion – Allow process to evaluate a record multiple times in a single save operation?
When you add objects to your process, you can choose to evaluate a record multiple times in a single save operation.
If you choose this option, the process can evaluate the same record up to five additional times in a single save operation. It might reevaluate the
record because a process, workflow rule, or flow updated the record in the same save operation. When a record is reevaluated, the process uses
the most recent values for that record.
For example, your sales review process includes multiple steps, approvals, notifications, and fields that need to be updated. Some of these
changes may be part of your process, or they may be managed by other workflow rules or flows in your org. If you let the process reevaluate a
record multiple times in a single save operation, you can manage and evaluate all of these changes—even changes from other processes—in a
single save operation in your process.
Example:
In process builder = if b=100 =>change c= 200
In flow if a-10 => b =100
Initial Value :b, c =>0 a=10
B has no value so process builder is bypass
Flow has a=10 so b becomes 100
Now Process builder already ran but we have checkbox true-so it verifies.
Now as b = 100, so c becomes 200
Error: Reference source not found
Do you want to execute the actions only when specified changes are made to the record?
It is equal to Created or edited to subsequently match the criteria of workflow
What should be the condition we need to specify in process builder to specify schedule actions?
Below are 2 conditions:
Only when record is created
When record is created or edited and while define criteria select the checkbox for below setting
Is it possible to edit the process once it is activated?
No, You need to clone and while cloning you can create new process or create new version.
Error: Reference source not found
What can be done using Process Builder?
Creating records: This will allow you to create a new record and create different field values for a record.
Updating records: You can update one or more records which are somehow related to the record that started the process. This can be done either
by manually entering records or by using the records from a related record.
Posting on Chatter: Process Builder allows you to post on Chatter for sharing any information to any user.
Quick action: If you already have global actions or objects, within Salesforce, you can use Quick action to use them in any other record.
Launch/trigger the flow: It is possible for you to launch the flow from your process to automate different processes.
Submitting the record automatically for approval: The record which started your process can be submitted. Any other record can’t be
automatically submitted.
Call/trigger Apex code: You can invoke an Apex code which you have already written within Salesforce.
Invoking another process: This action will actually invoke a process to another process.
Whenever there is any change into Contact Email update custom field of Associated Account with the latest Changes into the account
email.
We will go for process builder because using workflow we cannot update related record other than master detail
Update custom field of Account Object?
Workflow is the right automation tool for the above scenario
Update all related case and Contacts with the same email of account whenever account email changed.
Process Builder will be the right tool to use here as we need to update all contacts and cases there may be more than 1 and Process Builder
allows you to do the same.
Count no of child records related to master record into Lookup relation.
You have to go for the custom solution using Apex Trigger.
Error: Reference source not found
What DML operations can be done using Process builder
1. Process Builders cannot handle before DML It executes after a record has been created or updated. Whereas Apex triggers can handle both
before and after DML operations.
2. Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
Process Builder Vs Apex Trigger?
Process Builder Apex triggers
You cannot handle before DML operation.It executes only after a record You can handle both before and after DML operations.
has been updated or created.
You cannot handle deleting and undelete DML. You can handle all DML operations.
An error reported in Process Builder is more generic which makes it Exception handling can be made more specific.
difficult to find the origin of the error.
You cannot update unrelated records. You can update unrelated records.
You have to use Process Builder in conjunction with flows to create Share records with more complex criteria than sharing Rules
custom record sharing. Permits.
You cannot create email templates that pull information from multiple You can create email templates that pull information from
records and objects combined, solely by using Process Builder. multiple records and objects (combined with Visualforce).
Error: Reference source not found
What is Mixed DML Operation and how to solve Mixed DML Operation Error in Process Builder in Salesforce?
If any user wants to perform DML operation on setup and non-setup object in the same transaction then there is a chance of generating “Mixed
DML Operation” error.
Example:
ABC company give a requirement to their employees, if any employee joins our company then we will create a user in user object and as well as
we will auto create a sick leave, casual leave, earn leave in there leave balance object which is a custom object. If an employee will perform this
scenario then an employee will get Mixed DML Operation error.
Solution:
As we know we can not use DML operation on the setup and non-setup object in the same transaction then we have to separate it by time
dependent trigger
Error: Reference source not found
How to call Future methods from Process Builder?
To call Future methods from Process Builder, call the future method from the invocable method.
What are the things which we can not do with process builder in Salesforce?
1. Deleting Records (Alternative: Flows/Apex Trigger )
2. Outbound Message (Alternative: Workflow/Apex Trigger)
3. Cloning a record (Alternative: Apex Trigger)
4. Updating unrelated records (Alternative: Flows/Apex Trigger)
Error: Reference source not found
What kind of related records can we update using process builder in Salesforce?
Parent Records (Master or Lookup)
Child Records (Master or Lookup)
Flow
Error: Reference source not found
What is difference between screen flow and auto launched flow?
Screen Flow-Requires user interaction, because it includes screens, local actions, steps, choices, or dynamic choices. Screen flows don’t support
Pause elements.
Autolaunched Flow-Doesn’t require user interaction. This flow type doesn’t support screens, local actions, choices, or choice sets
What is invocable method?
@InvocableMethod annotation is required for callinsg any apex method from flow.
For Flow, care should be taken to retrieve records once and then loop through them rather than repeatedly retrieving records through multiple
loops (this is equivalent to not performing SOQL within a loop).
Error: Reference source not found
Difference between flow and process builder?
Process Builder Salesforce Flow
Not all objects are supported by Process Builder. Many objects are accessible using Salesforce Flow. For example –
OpportunityContactRole, UserDevice, etc.
Can be triggered when a record is created or edited. Can be triggered when a record is created, edited, or even deleted.
Can’t be triggered after a successful login. Can be triggered when a user successfully logs into Salesforce.
Not possible to save the newly created record ID (If it is created Possible to store the newly created record ID in a variable; so that, you
using the Record Create element). can reference it in a flow later.
Good for the intermediate use case. Much more power to implement complex logic.
Can’t be used to capture user input(s). Can be used to capture the user input(s) and later process it based on
your business use case.
Developer Questions
Trigger
Error: Reference source not found
What is a Trigger?
The trigger is defined as an Apex code that execute before or after the following functions such as insert, update and delete etc. Trigger enables
to perform custom actions before and after modifications to the records of Salesforce.
Types of Apex triggers
There are two types of triggers:
• Before trigger are used to update or validate values of a record before they are saved to the database.
• After trigger are used to access field values of the records that are stored in the database and use these values to make changes in other records.
The records that fire the after trigger are read only.
Trigger Syntax
1 trigger TriggerName on ObjectName (trigger_events) {
2
3 // Implement the Logic here
4 code_block
5}
Example:
1 trigger myAccountTrigger on Account (before insert, before update) {
2
3 CreateAccount.getAccount();
4
5}
1. myAccountTrigger – triggerName ( It is the name you would want to give your trigger).
2. Account – Objectname (It is the object on which the action needs to be performed).
3. before insert, before update – Trigger_events
Before insert: When using this event, the code block gets executed before a new record is inserted.
Before update: When you use this event, the code will get executed before a new record is updated in the object.
Variable Usages
Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an
isExecuting
executeanonymous() API call.
isInsert Returns true if this trigger was fired due to an insert operation.
isUpdate Returns true if this trigger was fired due to an update operation.
isDelete Returns true if this trigger was fired due to a delete operation.
isBefore Returns true if this trigger was fired before any record was saved.
isAfter Returns true if this trigger was fired after all records were saved.
isUndelete If a record is recovered from the recycle bin it returns trigger true.
Returns a list of the new versions of the sObject records. This sObject list is only available in insert, update, and
new
undelete triggers, and the records can only be modified before triggers.
A map of IDs to the new versions of the sObject records. This map is only available in before update, after insert, after
newMap
update, and after undelete triggers.
Returns a list of the old versions of the sObject records. This sObject list is only available in update and deletes
old
triggers.
oldMap A map of IDs to the old versions of the sObject records. This map is only available in update and deletes triggers.
Triggers Workflow
• Trigger is a piece of code that executes before or after a • Workflow is automated process that fired an action based on
record is inserted or updated. Evaluation criteria and rule criteria.
• We can access the trigger across the object and related to that
• We can access a workflow across the object.
objects.
• More than 15 DML operations can be used in a single • We cannot perform DML operation on workflow. Only insert and
trigger. update.
• We can use 20 SOQL’s from data base in one trigger. • We cannot query from database.
Validation rules are used to confirm that the data entered into Triggers can be used for various different things and can be executed
a record meet various data quality / business rules before at different times - e.g. when initiating a new record, before saving it,
letting the user save it. when a record is deleted.
Validation rules are very easy to create and virtually anyone Triggers are more complex and generally require some development
can learn how to create these. skills.
Scenario I
Populate a lookup field on record update:
Traditionally required a trigger and It can be Process Traditionally been something that requires a Trigger. Process
done easily with process builder. builder builder allows administrator can do this without the use of the
The issue is Multi layer lookup logic- i.e. Trigger code.
multiple / nested maps of related data required
in the trigger.
Process
Scenario II Process builder can be used to assign ownership of records based
builder
Set an Account Owner based on Record criteria on criteria in the object.
Trigger
Process
Scenario III Process builder can be used to post to chatter based on record
builder
Post a chatter message based on record criteria criteria.
Trigger
Scenario IV Process Requires 2 Processes one to Update the Quote based on the
Submit a Quote for Approval when builder opportunity stage and another to submit the quote for the approval
Opportunity Stage= Proposal Trigger when the criteria on the quote had been met.
Scenario V Process
Process builder can be used to set record criteria and then launch
Launch a Flow via record criteria vs a button or builder
a trigger ready flow.
link. Trigger
Scenario VI Process Although Process builder can create a new record it can’t
Clone an opportunity and change the field builder reference any of the values from the cloned opportunity without
values Trigger the use of a flow to capture the opportunity values.
Governor Limits
• SF runs in a multitenant shared environment, where thousands of orgs share the same Salesforce Instance. Resources like CPU power, RAM and
bandwidth are all shared in the same Instance. As a result, and to protect the Instance resources, Salesforce has implemented Resource Usage
Limits. These are called Governor Limits.
Description Synchronous Limit Asynchronous
Limit
Total number of SOQL queries issued 100 200
Total number of records retrieved by 50,000
SOQL queries
Total number of records retrieved 10,000
by Database.getQueryLocator
Total number of SOSL queries issued 20
Total number of records retrieved by a 2,000
single SOSL query
Total number of DML statements issued 150
• Force.com Platform Apex Limits. Some limits aren’t specific to an Apex transaction and are enforced by the Force.com platform like; Max #
of Apex classes scheduled concurrently (100). Max # of batch Apex jobs queued or active concurrently (5). Max # of batch Apex job start
method concurrent executions (1). Max # of batch jobs that can be submitted in a running test (5)
The Apex Flex queue enables you to submit up to 100 batch jobs for execution. Any jobs that are submitted for execution are in holding status
and are placed in the Apex Flex queue. Up to 100 batch jobs can be in the holding status.
Error: Reference source not found
Can you change order of job in Apex Flex Queue?
Jobs are processed first-in first-out—in the order in which they’re submitted. You can look at the current queue order and shuffle the queue, so
that you could move an important job to the front, or less important ones to the back.
1
2Boolean isSuccess = System.FlexQueue.moveBeforeJob(jobToMoveId, jobInQueueId);
3
Why to use Batch class as we already having data loader to process the bulk data.
Agree with this point if and only if the data needs to be updated is static or predefined or which can be done through excel.
We will choose batch class if we have to perform some custom calculations at run time or if you want to run some complex logic which can't be
driven by excel sheets in those cases we have to go with batch classes.
Examples:
Do some relationship quires to update the data.
Make a call out to get the some information related to each record.
Error: Reference source not found
How many times the execute method will be executed to process the 1234 records.
It depends on your batch size what you have configured at the time of calling the batch class from schedule class.
Execution method count = Total No Of Records/Batch Size (Any decimal ceil it to upper value)
If you haven't set any batch size then - 1234/200 = 6.17 = 7 times execute method will be called
Holding : Job has been submitted and is held in the Apex flex queue until system resources become available to queue the job for processing.
Queued : Job is awaiting execution.
Preparing : The start method of the job has been invoked. This status can last a few minutes depending on the size of the batch of records.
Processing : Job is being processed.
Aborted : Job aborted by a user.
Completed : Job completed with or without failures.
Failed : Job experienced a system failure.
Error: Reference source not found
Can you write a batch class blueprint?
1
2 global class batchExample implements Database.Batchable<sObject> {
3 global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {
4
5 // collect the batches of records or objects to be passed to execute
6 }
7
8 global void execute(Database.BatchableContext bc, List<sObject> records){
9 // process each batch of records
10 }
11
12 global void finish(Database.BatchableContext bc){
13 // execute any post-processing operations
14 }
15
16 }
17
Error: Reference source not found
Let’s say Record A has to be processed before Record B, but Record B came in the first Batch and Record A came in the second batch.
The batch picks records which are unprocessed every time it runs. How will you control the processing Order?
The Processing order can’t be controlled, but we can bypass the record B processing before Record A. We can implement Database.STATEFUL
and use one class variable to track whether Record A has processed or not. If not processed and Record B has come, don’t process Record B.
After all the execution completes, Record A has already been processed so Run the batch again, to process Record B.
Let’s say, we have run an apex batch to process 1000 records, and It is running with batch size 200. Now, while doing DML on 395th
record, an error occurred, What will happen in that case?
In batches, If the first transaction succeeds but the second fails, the database updates made in the first transaction are not rolled back.
Since the batch size is 200, so the first batch will be processed completely and all data will be committed to DB. In seconds batch, if we are
committing records using normal DML statements like insert, update than the whole batch will be rollbacked. So records 201 to 400 will not be
processed.
1
2 global class ContactUpdate implements Database.Batchable<sObject>
3 {
4 global Database.QueryLocator start(Database.BatchableContaxt bc)
5 {
6 String query = 'select id, phone, Account.phone from Contact';
7
8 return Database.getQueryLoactor(query);
9 }
10 global void execute(Database.BatchableContext bc, List<Contact> scope)
11 {
12 for(contact con: scope)
13 {
14 con.phone = con.Account.phone;
15 Conlist.add(con);
16 }
17 update con;
18 }
19 global void finish(Database.Batchable Context bc)
20 {
21
22 }
23 }
24
Why Future?
If you want to run processes in a separate thread, at a later time and want to execute the code asynchronously, we need to use future methods.
Error: Reference source not found
When future is used?
These are used for long-running operations such as callouts to external Web services or any operation you would like to run in its own thread
Syntax:
global class <ClassName> {
//Below is future annotation which defines the given method is future method.
@future
public static void <FutureMethodName>(List<Id> recordIds) {
List<Contact> accounts = [Select Id, FirstName, LastName from Contact Where Id IN :recordIds];
// process contacts records to do awesome stuff
}
}
Error: Reference source not found
Why Queueable Apex?
Like the future is also used to execute the asynchronous code, and it enables you to add jobs in a queue and enhance the way of running
asynchronous code in comparison to the future method.
When queueable is used?
For Apex processes that run for a long time, such as extensive database operations or external Web service callouts, you can run them
asynchronously by implementing the Queueable interface
Syntax:
public class <Name of Queueable Class> implements Queueable {
//This is the only method which is contained by the Queueable Interface and required to inherit this method in Queueable class.
public void execute (QueueableContext context) {
//Code which needs to be executed
}
}
Error: Reference source not found
1. Future will never use to work on SObjects 1. Queueable Jobs can contain the member variable as
or object types. SObjects or custom Apex Types.
2. When using the future method we cannot 2. When using queueable jobs it will make the AsyncApexJob
monitor the jobs which are in process. which we can monitor like Scheduled jobs.
3. The future method cannot be called inside 3. Queueable Apex can be called from the future and batch
the future or batch class. class.
4. The future method will never be queued. 4. Using Queueable Apex will chain up to queueable jobs and
in Developer Edition it is only 5 Jobs.
Use of without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced.
If we don't use the With/without Sharing keyword then the class will run in the System Context. In system context, Apex code has access to all
objects and fields— object permissions, field-level security, sharing rules aren't applied for the current user.
Classes inherit this setting from a parent class when one class extends or implements another. Inner classes do not inherit the sharing setting
from their container class.
Test Classes
Test Types
Error: Reference source not found
1. Single Records:
This includes testing to verify that a single record produces the correct,
expected result
2. Bulk Records:
Any apex code, whether a triggers, a class or on extension may be used
for 1to 200 records we must test not only the single record case, but the bulk
cases as well.
3. Positive scenarios:
This type of component testing expect a system to save a record without error.
4. Negative scenarios:
This type of component testing expect a system to give error.
5. **Restricted User:
Test whether a user with restricted access to the objects used in code sees
the expected behavior, i.e whether they can run the code or receive error
messages.
Error: Reference source not found
How is a test method defined?
A test method is defined as mentioned below:-
Syntax:
Multiple statements on one line are counted as one line for the purpose of code coverage. If(true){I=1}
Error: Reference source not found
Which classes are excluded from code coverage calculation?
Test classes (classes that are annotated with @isTest) are excluded from the code
coverage calculation.
Methods that are annotated with @testSetup are used to create test records once
and then access them in every test method in the test class.
Test setup methods enable us to create common test data easily and efficiently.
By setting up records once for the class, we don’t need to re-create records for each test method.
Example: For example, we have a test class, It has two test methods and each
test method required 5 account records.So without creating 5 records for each
test method, we will create a new method with annotation @testSetup then
create only 5 account records. These records can access all test methods using
SOQL query in that test class.
Error: Reference source not found
What are the things to remember when we use @testSetup method?
All database changes are rolled back at the end of a test. We can’t use this method on records that existed before the test executed. We also can’t
use setCreatedDate in methods annotated with @isTest(SeeAllData=true), because those methods have access to all data in the org. The both
parameters (Id recordId, Datetime createdDatetime) of this method are mandatory.
What is the difference between testMethod and @isTest?
@isTest annotation is used to define the test classes which contains code to test
our application and these classes does not count against our overall code
coverage.
testmethod keyword is used to define apex test methods. Also test methods can
be defined in any apex class.
Error: Reference source not found
@testVisible annotation?
Some methods are declared as private so we won’t be able to call them outside
the class. However, sometimes we really want to be able to invoke it from a unit
test method.
To resolve this, we can mark the method with a @TestVisible annotation. Then
although it is still private, it is invokable from our unit test methods.
How is a class defined as a test class ?
Use @isTest annotation to define a test class.
Exception Handling
Exceptions
• In SF, a compile error is a Syntax error that won’t let you save your code. An Exception is a non-syntax error and can be anything
which interrupts the normal flow of the execution AKA Bug. An Exception is more of a Logical error, or an error that occurs when us-
ing certain data as opposed to others
• When an Exception can occur: For example, when trying to reference a null variable or when trying to insert a record without defin-
ing the mandatory fields
• Unhandled exceptions are exceptions that the code doesn’t catch and this is the default in SF, They cause your whole code execution
to stop and exit. Any DML operations that were processed before the exception are rolled back and not committed to the database. Get
logged in debug logs. End user sees an error message in the SF user interface
Handled exceptions are exceptions that the code does catch with writing extra code. They are handled in a way that will NOT stop the
whole code. Instead of throwing the exception and stopping the code, handled expectation can display a code that you type. Any DML
operations that were processed before the exception handling are committed to the database. Any code after the exception handling
block is processed
Try-Catch-Finally statement
• Can be used together to capture an exception and handle it gracefully without stopping the code. A Try block encloses the code where
exception may occur. A Catch block comes immediately after the try block and handles the exception and takes an argument of an
Exception Type variable. Can have 0 or more Catch blocks, each handling an exception type, and it will run based on the Exception
type
Can have 0 or more Finally blocks, that is always executed at the end, that allows to clean the code. At least 1 Catch or Finally block
must be present after Try
Note: Any statements in the try block occurring after the exception are skipped and aren’t executed.
• System Defined Exceptions: The exception class defines standard exceptions and contains methods for interrogating exceptions.
DMLException (when DML operations fail), ListException, NullPointer (when we try to reference a null variable) or generic
Exception
• Exception Methods: The Exception Class has many Methods that can be used with the Exception variable; getCause, getLineNumber,
getMessage, setMessage
• Catch Different Exception Types: We use more than 1 catch block top catch different exceptions to give different debug messages
for each exception type. When an Exception type is used and a Catch block is accessed, the code will then exit the whole block, so no
other Catch block will run.
• Best practice is to use several catch blocks: A catch block for each exception type and, A final catch block that catches the generic
Exception type and Always start from the most specific exception type, to the general
• Throw statement will throw an Exception and stop the execution. Similar to the addError() Method that we saw in Trigger, but
addError() method can only be used in triggers. We can use addError() method for only records that are available in Trigger Con-
text.
• Custom Exception Class: We cannot throw the System exceptions. Trying to do so will result in error: “Type cannot be constructed:
Exception”. To create our custom exception class, extend the built-in Exception class and make sure our class name ends with the
word Exception, such as “MyException” or “PurchaseException”. All exception classes extend the system-defined base class Excep-
tion, and therefore, inherits all common Exception methods. Once you create the custom Exception class, you can construct exceptions
from it, and use them in Throw
Aura
Where to use Lightning Components?
Answer: The Lightning components can be used in the following ways:
Drag-and-drop components are meant for the Lightning App Builder and Community Builder.
Add Lightning Components for Lightning Pages.
Add Lightning Components for Lightning Experience Record Pages.
Launch a Quick-action Lightning Component.
Overrule the Lightning Component’s standard actions.
Create custom applications
Error: Reference source not found
What are the components bundles used in the Lightning component?
Answer: The component bundles are enlisted in the below table:
Name of Component
Sl. No. Description
Bundle
The developer can write the common logic inside helper used by different
3 Helper
controller methods, avoiding any sort of repetition
4 Style This is about the style of the component.
This icon in the Lightning App Builder gets displayed before the
7 SVG
component.
It not only helps in component reusability but also controls which all
8 Design
attributes need to exposed for the tools like Lightning App Builder.
Lightning Component Bundle includes:
● Component– A markup language is used for configuring the layout of the component.
● Controller– A JavaScript Controller is used for handling client-side processing or an apex controller is preferred for server-side
processing.
● Design File– A design file is used for describing the design-time behavior of the component being used in Lightning pages or in
Lightning App Builder.
● Documentation File–It is used to provide reference documents or sample code to users who have received your component.
● Helper–aims at storing reusable JavaScript functions which are handled by the controller. (server-side controller. It is usually used
for firing server-side actions and processing data or tasks. we can call Helper’s java-script function from a client-side controller or
renderer; It’s a JavaScript resource that defines the functions for all the component’s actions. When an event is fired, it may trig-
ger actions to change data and call rerender() on affected components. The rerender() function enables components to update
themselves based on updates to other components since they were last rendered)
● SVG File–enables you to include custom icons that can be used for reference further.
Lightning framework aligns with Salesforce user interface strategy to empower users with highly immersive and interactive
experience but involves a steep learning curve in comparison to Visualforce. Since application building is an inherent part of
Lightning, it is considered a bit more complex than Visualforce.
Both the frameworks encompass some pros and cons associated with them.
Data updates in either component are reflected through bidirectional data binding in both components. Similarly, change handlers are triggered
in both the parent and child components.
Important Topics:
**Attribute
**How to call Apex Server
**Attribute binding
**Components Events (Bubble and capture phase)
**Application Event(Bubble and capture phase)
LWC
LWC data binding
Data binding in LWC is unidirectional. This is, the value of a property will propagate down, from parent to child, but never up, from child to
parent. The way to communicate from child to parent needs to be done in a different way, using events. The child component will fire an event,
that the parent component will listen to.
We can summarise this saying that, while in aura data binding was bidirectional, in LWC is unidirectional. This means, for sending information
from a parent to a child LWC, we use properties. While child components pass data up by firing events.
@api
To expose a public property, we decorate a field with @api . Public properties define the API for a component.
But To expose a public method, decorate it with @api . Public methods are part of a component’s API. To communicate down the containment
hierarchy, owner and parent components can call JavaScript methods on child components.
@track
Fields are reactive. If a field’s value changes, and the field is used in a template or in a getter of a property that’s used in a template, the
component rerenders and displays the new value.
For example, When a field contains an object or an array, there’s a limit to the depth of changes that are tracked. To tell the framework to observe
changes to the properties of an object or to the elements of an array, we decorate the field with @track .
@wire
Wire is generally used whenever is component load, at that moment I have to specify something, you know wire is configured with 3 things,
adapterID, adapter configuration and property which can be any object like Contact.
Adpater Id is the same id we are importing using import command. Adapter configuration is, If the import command require any configuration,
then we are using the configuration in adapter id.
Then we have property that will store all of the outputs we get from adapterid.
To read Salesforce data, Lightning web components use a reactive wire service. When the wire service provisions data, the component rerenders.
Components use @wire in their JavaScript class to specify a wire adapter or an Apex method.
Lightning Data Service is built on top of User Interface API. UI API is a public Salesforce API that Salesforce uses to build Lightning
Experience. Like its name suggests, UI API is designed to make it easy to build Salesforce UI. UI API gives you data and metadata
in a single response
There are typically 3 approaches for communication between the components using events.
Communication using Method in LWC ( Parent to Child )
Custom Event Communication in LWC(Child to Parent )
Publish Subscriber model in LWC ( Two components which doesn't have a direct relation )
So, some recommendation for DOM Event.
No uppercase letters
No Spaces
use underscores to separate words
Don't prefix your event name with string "on".
<template>
</template>
childEx.js
The lightning/empApi module provides access to methods for subscribing to a streaming channel and listening to event messages.
All streaming channels are supported, including channels for platform events, PushTopic events, generic events, and Change Data
Capture events. This component requires API version 44.0 or later. The lightning/empApi module uses a shared CometD
connection. Example Code.
6) Debug LWC
Use Chrome pretty JS setting to see unminified JavaScript and Debug Proxy Values for Data. Here is example.
Enable Debug mode
It gives unminified Javascript
Console warnings
Pretty data structure
But Caution - it reduces performance of Salesforce, make sure its disabled in production
7) Use Storable Action
Use Storable Action, It will reduces call to Server. Syntax - @AuraEnabled(cacheable=true)
Caution: A storable action might result in no call to the server. Never mark as storable an action that updates or deletes data.
For storable actions in the cache, the framework returns the cached response immediately and also refreshes the data if it’s stale.
Therefore, storable actions might have their callbacks invoked more than once: first with cached data, then with updated data from
the server.
Is there any difference in how we add LWC component inside another LWC component and inside AURA component ?
LWC follows kebab case if you are adding any LWC component inside another component you will have to add in kebab case form
while in AURA it will be added without kebab case for example :
We have component with name “childLWCComponent”
- Connectedcallback : Called when the element is inserted into a document. This hook flows from parent to child. This is
similar to init() in aura.
- RenderedCallback : When component finishes loading DOM elements. This hook flows from child to parent.
<PARENTWCCOMPONENT>
<c-child-l-w-c-component/> //Name of child LWC is 'childLWCComponent'
</PARENTWCCOMPONENT>
- Disconnectedcallback : Called when the element/component is removed from a DOM. This hook flows from parent to child.
<PARENTWCCOMPONENT>
<IF {showSection =true}>
<c-child-l-w-c-component/>
</IF >
</PARENTWCCOMPONENT>
Is wire method called multiple times during lifecycle of component ? (True / False)
True
----------------------------------------------------------------------
get someVariable() {
if(this.valToChek >0)
return true;
else
return false;
}