Salesforce Interview Questions with Answers Part 59

1. Set Checkpoints in Apex Code
Use Developer Console checkpoints to debug your Apex classes and triggers. You can’t set checkpoints in Visualforce markup.

Checkpoints persist until you click Debug --> Clear Checkpoint Locations.

Use checkpoints to investigate the objects in memory at a specific point of execution and see the other objects with references to them.

If you set a checkpoint in a method with the @future annotation, you must keep the Developer Console open until the @future method completes asynchronously.

2. Debug Log limit in Salesforce
Each debug log must be 20 MB or smaller. If it exceeds this amount, you won’t see everything you need. Additionally, each org can retain up to 1,000 MB of debug logs. The oldest logs are overwritten.

3. Difference between authorization code, access token, and bearer token?
An auth-code (short for authorization code) is a unique string of random letters and numbers assigned to a domain. When you transfer a domain to another registrar, its auth code is required to start the transfer. This helps prevent domain hijackers from transferring a domain without the owner's permission. Authorization codes must be retrieved from the current domain registrar where the domain is registered.

Access tokens are credentials used to access protected resources. An example of a protected resource is a REST API exposed by Salesforce.

Refresh tokens are credentials used to obtain access tokens. Refresh tokens are issued to the client by the authorization server and are used to obtain a new access token when the current access token becomes invalid or expires.
In order to access an API for example, you need to use an Access Token. Access tokens are short-lived (around an hour). You use the bearer token to get a new Access token.

4. How to reference Custom Metadata Type Record in Salesforce Flows?
Use Get Records flow component to fetch and reference Custom Metadata Type Record in Salesforce Flows.

5. How to embed a Visualflow in a Visualforce page?

<flow:interview name="flowuniquename"/>


6. Why are Visualforce pages served from a different domain?
Visualforce pages are served from a different domain to improve security standards and block cross-site scripting.
If it runs in the same domain, the scripts on the VF page will be able to access the scripts on the standard page-layout and will be able to manipulate it.

7. Troubleshoot network performance issues with ping and traceroute

8. Connection Pool Errors in Salesforce
If you receive the following error message, your organization may experience performance issues and possible service disruptions.

HTTP Status 500
Unable to find a connection to send a request

This system exception will be raised when your Salesforce organization database is unable to communicate with internal data sources. These limits are determined by your current Salesforce edition (displayed in the title bar of your browser).

Possible connection pool error scenarios:

Inefficient SOQL queries
Insufficiently configured reports, dashboards, and list views

9. Row Lock or Lock Row in Salesforce
When a record is being updated or created, we place a lock on that record to prevent another operation from updating the record at the same time and causing inconsistencies on the data. These locks normally last for a few seconds and when the lock is released, other operations can do whatever processing they are supposed to do on the record in question. However, a given transaction can only wait a maximum of 10 seconds for a lock to be released, otherwise, it will time out.
Check the below link for more information

10. Salesforce Data Skew
When you have a very large number of child records associated with the same parent record in Salesforce, we call that “data skew”.

Types of Salesforce Data Skew
Account Data Skew
Certain Salesforce objects, such as accounts and opportunities, have special data relationships that maintain parent and child record access under private sharing models. If too many child records are associated with the same parent object in one of these relationships, this imbalance causes something called “account data skew,” which in turn causes performance problems.

Ownership Skew
Similarly, when a large number of records with the same object type are owned by a single user, this imbalance causes something called “ownership skew.” Ownership skew also causes performance problems, which can surface when you’re managing your role hierarchy and sharing rules.

Lookup Skew
Lookup skew happens when a very large number of records are associated with a single record in the lookup object.  Because you can place lookup fields on any object in Salesforce, lookup skew can create problems for any object within your organization.

11. Concurrent Apex Errors
If you receive the following error message, your organization may experience performance issues and possible service disruptions.

'Unable to process request. Concurrent requests limit exceeded.'

This system exception will be raised when your concurrent Apex requests exceed governor limitations for your Salesforce organization. These limits are determined by your current Salesforce edition.

If Synchronous Apex runs more than 5 sec it considered a long-running job. And we have a limit that only 10 long-running jobs can execute at a time. So, whenever 11th Synchronous apex tries to execute, it gets Concurrent Apex limit error

Possible concurrent Apex error scenarios:

Poorly coded Apex
Synchronous callouts from Visualforce pages
Inefficient SOQL queries

12. Parameterized Typing in Apex in Salesforce
Apex, in general, is a statically-typed programming language, which means users must specify the data type for a variable before that variable can be used.
This is legal in Apex:
Integer x = 1;

This is not legal if x has not been defined earlier:
x = 1;

13. Difference between public, private, protected and global access modifiers in Salesforce?
private is the default and means that the method or variable is accessible only within the Apex class in which it is defined.  If you do not specify an access modifier, the method or variable is private.

We can access the global class anywhere irrespective of the namespace. If you declare a method or variable as global, you must also declare the class that contains it as global.

Public class is accessible within namespace only.

Protected means that the method or variable is visible to any inner classes in the defining Apex class, and to the classes that extend the defining Apex class. You can only use this access modifier for instance methods and member variables.

Check the below link for more information.

14. What is the benefit of using Custom Label in Salesforce?
Custom Labels can be fetched in any language supported by the Salesforce platform. This gives flexibility to the developer to create a multilingual application which will automatically get translated to the user’s native language.
We can use it for configuring values to avoid SOQL.

15. LockerService For Lightning Components
At a high level, LockerService uses various technologies and techniques that are intended to do the following:


Components from causing XSS and similar security issues
Components from reading other component’s rendered data without any restrictions
Components from calling undocumented/private APIs


Cool new features like client-side API versioning similar to REST API versioning*
Faster security review
Better and more secure JS development practices
Running 3rd party JS frameworks like React, Angular and so on*
Easily adding or removing new security features and policies

Check the below link for more information

16. Difference between Governor limit and Heap limit in Salesforce
Governor Limit
If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.

Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources.

Heap limit
The allocation of memory storage for use in a computer program during the runtime of that program.
When you create objects in your Apex code, memory is allocated to store these objects.

17. What is the difference between LastModifiedDate and SystemModStamp?
Let’s recap what LastModifiedDate and SystemModStamp dates are. They are both system fields that store date and time values for each record.

LastModifiedDate is automatically updated whenever a user creates or updates the record. LastModifiedDate can be imported with any back-dated value if your business requires preserving original timestamps when migrating data into Salesforce.

SystemModStamp is strictly read-only. Not only is it updated when a user updates the record, but also when automated system processes update the record. Because of this behavior, it creates a difference in stored value where ‘LastModifiedDate <= SystemModStamp’ but never ‘LastModifiedDate > SystemModStamp’.

So, how does this affect the performance of a SOQL query? Under the hood, the SystemModStamp is indexed, but LastModifiedDate is not.

LastModifiedDate and SystemModstamp will differ when automated processes update the records, which will happen in the following scenarios (asynchronously in some cases):

a) The archive date is extended to greater than 365 days.
b) An existing picklist value is updated (not replaced with an existing picklist value).
c) A contact's e-mail address is flagged as per the Email Bounce Management configuration.
d) The LastActivityDate field is modified
e) Roll-up summary field is created, which will update all the parent records' SystemModstamp asynchronously. Recalculation will also take place if the Summary Type is updated.
f) Some Salesforce Internal backend processes also update SystemModstamp as SystemModstamp is used internally to signal that a record (or related data) may have changed and that internal processes may need to synchronize themselves to the new record data.

18. What is the difference between External lookup relationship and Indirect lookup relationship
External lookup relationship

External lookup relationship links a child standard, custom, or external object to a parent external object. The values of the standard External ID field on the parent external object are matched against the values of the external lookup relationship field. For a child external object, the values of the external lookup relationship field come from the specified External Column Name.

In the External lookup relationship, External Object will be the parent.

Indirect lookup relationship

An indirect lookup relationship links a child's external object to a parent standard or custom object. You select a custom unique, external ID field on the parent object to match against the child’s indirect lookup relationship field, whose values are determined by the specified External Column Name.

In an Indirect lookup relationship, the Salesforce standard or custom object will be the parent and External Object will be the child.

No comments:

Post a Comment