Sunday, 14 May 2023

Quick tips to optimize your Salesforce org

 1. Keep your Salesforce org clean and organized by regularly archiving or deleting old data.

2. Use custom settings in Salesforce to store configurable settings that can be easily changed without modifying code.

3. Leverage the power of Salesforce reports and dashboards to gain insights into your data and make data-driven decisions.

4. Optimize your code by using SOQL queries to retrieve only the data you need, rather than retrieving all records and then filtering them in code.

5. Use validation rules in Salesforce to enforce data integrity and ensure that data entered into your org meets your business requirements.

6. Make your Salesforce org more user-friendly by customizing page layouts and creating custom fields and objects.

7. Automate repetitive tasks in Salesforce by using tools like flows to save time and increase efficiency.

8. Improve collaboration and communication within your team by using Salesforce Chatter to share information and collaborate on projects.

9. Use Salesforce mobile app to access your Salesforce data from anywhere, at any time, and keep track of your sales on the go.

10. Keep your Salesforce org secure by implementing two-factor authentication and regularly reviewing user permissions and access.

Best Practices For Large Data Volumes in Salesforce

 Your Org has tens of thousands of users, tens of millions of records, or hundreds of gigabytes of total record storage, have to follow best practices. Few Considerations:


Skinny Tables

Recommended to make your query fast. Important for batches taking long time to execute.


Indexes

Use index fields in where clause of Query. Multiple indexed field in query make it more faster. Even use Two-Column Custom Indexes. Two-column index is more efficient than single indexes on same fields.


Divisions

Partitioning the data of large deployments to reduce the number of records returned by queries and reports. For example, a deployment with many customer records might create divisions called US, EMEA, and APAC to separate the customers into smaller groups that are likely to have few interrelationships.


Mashups

One approach to reducing the amount of data in Salesforce is to maintain large data sets in a different application, and then make that application available to Salesforce as needed.


Deleting Data

Delete unused or unnecessary data. Use Bulk API's hard delete option, which allows records to bypass the Recycle Bin and become immediately available for deletion.


Search

When large volumes of data are added or changed, the search system must index that information before it becomes available for search by all users, and this process might take a long time.


Indexing with Nulls

Idea to reduce Null values, replace with NA or blank. Either use formula field to set value and index formula field.


API Performance

Add addition filter in rest API's query, so they don’t scan all salesforce data.


Sort Optimisation on a Query

Add a limit or sort order in query to make it fast and scan a limit of data only.

Field Trip (ZoomInfo Field Trip App Exchange tool)


Field Trip for Data Analysis and Data Cleansing Process

 

 Field Trip is a free tool on the Salesforce AppExchange that is incredibly simple to use and can empower admins and reveal what fields the team is using. Working through the fields is easier with Field Trip Analysis’ that run against specific objects. Running this analysis gives insight into the following:

  • Identify and remove fields that aren’t used
  • Make important fields required
  • Clean-up Page Layouts
  • Identify what data your users think is valuable

 

Field Trip mainly comprises of two objects namely,

1. Field Trip

2. Field Analyses

In the Field trip object, the user can give the name for field analysis, object API name and the criteria to filter the field for the record. Thus, it will list all the custom and standard fields of the selected object. It also provides the information of the percentage of the field utilization along with record count.

The Field Analyses object contains all the details like Field name, label, Type, PopulateOn and PopulateOn% in which we want to analyze. The Field Analyses (child) object has a master-detail relationship with Field Trip (Parent) object. So, the Field Trip Analyses object details are displayed in the related list of Field Trip object.

It also provides us the facility to generate the field trip reports monthly and current date (today’s date) report. With the help of this report, we can easily find and remove the unused fields of objects in the organization.

 

Pros: 

  1. Easy to analyze the fields for all custom and standard objects fields.
  2. Field trip reports help to analyze the fields which are not used consistently.
  3. No limitation to the number of records or fields to be analyzed.
  4. Analyzing the subset of records by adding filters is possible.
  5. Cleaning up the unused fields in the object.

Cons: 

  1. In the Field Trip, we can’t create the report based on the page layout.
  2. All reports should display all the fields listed on an object.
  3. If we need to analyze the subset of records, then we require an SOQL Query to be built to filter those records.
  4. Field Creation Date is not available on the reports. When a field is created, the field utilization % will be zero. It would be nice if we could pull based on the creation date of the field.

Conclusion : 

This Field Trip Application is very simple and easy to use.This is the best tool for data cleansing  and data analyses process.Report generation helps us to easily find and remove any unused fields in the object.

 


Monday, 1 May 2023

How to Call Apex from Flow using Invocable Action :

 To call Apex from Flow, you need to define the method in your Apex Class as an Invocable Method. And here are some of the rules that you need to follow when using Invocable Method:


  • The Apex class must be defined as public or global.
  • There can be only one invocable method in the Apex class.
  • The invocable method must be static and public or global, and its class must be an outer class.
  • There can be at most one input parameter to Apex method and its data type must be of list type.
  • The data type returned by the method must also be of the list type.

Faster Account Sharing Rules Recalculation (Spring ’23)

 Salesforce provides implicit sharing between a parent account and its child objects (cases, contacts, and opportunities) and creates implicit child share records on these objects.


With Spring ’23 release it is changing the way that automatic sharing calculation works behind the scenes for case and contact objects. Salesforce will no longer store child implicit share records between accounts and their child case and contact records. Instead, the system dynamically determines whether users can access child case and contact records when they try to access them. Not storing the child implicit share records speeds up ownership and sharing rule recalculation for accounts.


To enable this feature, please contact Salesforce Customer Support.


References :

1.https://www.linkedin.com/pulse/faster-account-sharing-recalculations-larry-tung

Monday, 6 March 2023

Sharing Rules Recalculation

 1.Manual Sharing Rule Recalculation (Parallel Calculation)

2.Auto Sharing Rule Recalculation (One by One Calculation)


Manual Sharing Rule Recalculation (Parallel Calculation) :


whenever a sharing rule is recalculated manually, it is always done in parallel meaning all sharing rules calculation 

would start together and would run simultaneously.


If the number of records that are impacted by the recalculation are less than 25k or 25000 then in this case 

you would not receive an email upon completion of the recalculation.


We can track Manual Sharing Recalculation activity in the 'Background Jobs'.

we will find the start time along with the specific sharing criteria , percentage completed and the end time.



Note :

Manual sharing recalculation or parallel recalculation is faster than the Auto Sharing recalculation.


Auto Sharing Rule Recalculation (One by One Calculation) :


The Auto Recalculation of sharing rules is when some activity triggers the modification to the sharing rules and 

so a recalculation is done for the same by Salesforce without explicitly clicking on Recalculate button.


This happens when for example a record type is deleted or there is a change in the Role Hierarchy or any activity 

that sees a modification in the sharing rules. As soon as the activity is performed, Salesforce itselves starts the 

recalculation of the sharing rules for the whole org, this is done in a one by one mode meaning only one sharing rule at a time.


As only one sharing rule is calculated at a time it takes quite a long time depending on your org data.


To get an estimate of how much time would it take to recalculate the Sharing Rules on your org, 

Salesforce suggests that you run the same on a full copy sandbox. Ideally the time taken on the Full Copy sandbox 

is a replica of how much time it would take on your production instance.


Defer Sharing Calculations:


Deferring sharing calculation is ideal if you make a large number of changes to roles, territories, groups, users, 

portal account ownership, or public groups participating in sharing rules, and want to suspend the 

automatic sharing calculation to a later time.

Friday, 3 March 2023

Relationships In Salesforce

 


1. Lookup relationship

Parent record is not required when creating a child record as parent and child objects are loosely coupled.

Lookup relationship does not support roll-up summary field.

Lookup fields are not required on the page layout of the detail record but if you make them a required field, it is advised!

Standard object record can be on the detail side of a custom object in a lookup relationship.

By default record ownership of child records is not controlled by the parent.

Can have a child record without a parent.

Can have a maximum of 40 lookups on an object.

No cascade delete.


2. Master-detail relationship

Parent record is always required when creating a child record. That means parent and child object are strongly coupled.

Master detail relationship support roll-up summary field.

Parent record is required in order to save a child record.

Master-detail field is always required on the page layout of the detail record.

Standard object record cannot be a child.

The parent controls the record ownership of child records. The owner field is not available on the detail record in master-detail relationship queues, sharing rules and manual sharing is not possible for detail records as it requires the owner field.

You cannot have a child record without a parent.

You can have a maximum of two master details on an object.

Cascade delete.

 

3. Many-to-Many Relationships: 

If there is need to create the many-to-many relation then we need to use the Junction object in Salesforce. A junction Object is a type of custom object which allows linking two custom objects.

A junction Object in simple terms can be called a custom object with two master details fields.

Records of a particular object can connect with various records of different objects and vice versa.

 

4. Self-Relationship:

It means an Object is creating a relationship with itself. 

It creates a tree diagram of the objects.

 

5. Indirect lookup relationship:

This allows a relationship to be formed between a SF object and an external object. If your Salesforce org was the family, then the objects would be related but not in the same family. A great example of such is relating payment records to an account from an ERP system–the ERP system is external to Salesforce but the records are important. The way they relate is via an external ID to match the payments to the account.

External lookup relationships- allow a relationship to be formed between two external objects. Your two friends from outside of your group are now in a relationship. Maybe that ERP system links the payment records to a bank account.


6. Hierarchical Relationships:

This unique relationship can only be used on the user object and is designed to create a hierarchy of users. For example, it could be used to create a lookup field for the user object, which can be used to list the user’s manager.