What are Salesforce Big Objects?
Hey friends, we all know that objects in Salesforce are used to manage and manipulate our data. You’re probably pretty familiar with standard objects, custom objects, and external objects. But if you have to manage an enormous amount of data then that’s where you’ll want to leverage Salesforce Big Objects. These objects manage billions of records of data without compromising performance. Salesforce Big Objects allow you to source massive datasets from external systems into a big object, for a complete view of your customers. The greatest benefit of Big Objects is that it does not count against the data storage limit.
Clients and external systems can use a standard set of APIs to access the data of Big Objects. Big Objects are available for both Salesforce Classic and Lightning Experience.
Types of Salesforce Big Objects
There are 2 types of Big Objects:
- The Standard Big Object: They are defined by Salesforce. They include FieldHistoryArchive and are part of theField Audit Trail product. This is helpful for organizations that have a use case for regulations on auditing and data retention.
- The Custom Big Objects: They are defined by the user as per their requirement. You can implement a custom big object by using the Metadata API.
Use Cases for Salesforce Big Objects
- 360° View of the Customer: When you have a lot of customer information to store from an external system, you’ll want to use a Big Object in order to get a complete view of the customer. For example, data from a customer loyalty program would be a great use case for a big object.
- Historical Archive: When you have historical information that you don’t necessarily need at your fingertips, but may need to refer back to for reasons such as compliance, or a customer’s transaction history, a big object is a great option.
Considerations for using Salesforce Big Objects
- Big objects only support object and field permission. So you can implement sharing based rules on this.
- You can’t use standard features of Salesforce like triggers, flows, processes on Big Objects.
- You can create up to 100 big objects per org. The limit of the number of fields on the big object is similar to the custom object and it depends on your org’s edition and licensing.
- You can create big objects and fields from the UI as well as using Metadata API.
- Big objects available in Enterprise, Performance, Unlimited, and Developer Editions with one million records limit but by using an add-on license we can increase record capacity and Async SOQL.
- Suffix for the big objects is __b.
- Big Objects support custom Salesforce Lightning and Visualforce components instead of standard UI elements like detail pages, list views, and so on.
- Big objects only support Lookup Relationship, Date, Time, Email, Number, Phone, Text, Long Text Area, and URL Field types.
- Big objects do not support encryption.
How to Create Big Objects in Salesforce
We can define custom big objects with Setup and Metadata API. After defining the big objects we can add fields to it from the setup. To complete the setup of big objects we need to create a custom index. We can’t edit and delete the index.
How to Create Big Objects with Metadata API
To create the big objects from Metadata API we need an object file that contains the following:
- Object Files: Create a file that contains definitions of big objects, fields, and index.
- PermissionSet/Profile Files: This is not the required file but this file is used to assign the object and field permissions. This grants big object access to the user because by default big objects are restricted.
- Package File: A file for the deployment of metadata definitions and permission.
Let’s see the example. I’m creating an “Old Case History” big object.
- We need to create an object file with .object extension.
<?xml version=”1.0″ encoding=”UTF-8″?>
<label>Old Case History Index</label>
<label>Old Case History</label>
<pluralLabel>Old Case History</pluralLabel>
- We need to create a permission set file with the .permissionSet extension.
<?xml version=”1.0″ encoding=”UTF-8″?>
<label>Old Case History Permission Set</label>
- The final step is to create a package file.
<?xml version=”1.0″ encoding=”UTF-8″?>
How to Deploy a Salesforce Big Object
To deploy the big object, we need to create the following structure of the files.
- Create a folder “objects” and move the .object file to this folder.
- Create a folder “permissionSets” and move the .permissionSet file to this folder.
- Finally create a zip file with objects folder, permissionSets folder, and package.xml file.
4. Now, we can deploy this with the help of workbench. Login to workbench.
5. Select the migration tab, and select deploy. Then choose the .zip file from your system and check the ‘Single Package’ and click the ‘Next ‘option as shown below.
6. On this screen, you’ll see the deploy button. Click on deploy to push the big object to your org.
7. This will redirect you to the result screen.
8. Once you have successfully deployed a Salesforce Big Object you can validate the big object in your Salesforce org.
How to create a Salesforce big object record with Apex
You can create big object records using CSV files and Apex code.
CSV File: Use a data loader to import the records.
Apex Code: We can insert the data in big objects using Database.insertImmediate().
Old_Case_History__b obj = new Old_Case_History__b();
obj.Account__c = ‘0010K00002NezhdQAB’;
obj.Case_Number__c = ‘00215656’;
obj.Contact_Name__c = ‘Nidhi Vyas’;
obj.Description__c = ‘This is a testing record.’;
obj.Subject__c = ‘Test Check’;
SOQL with Big Objects
In the big object there are some limitations with SOQL.
- The soql doesn’t support !=, LIKE, NOT IN, EXCLUDES, and INCLUDES operators.
- Aggregate functions are not supported.
SELECT Account__c, Case_Number__c, Contact_Name__c, Description__c, Subject__c FROM Old_Case_History__b
WHERE Account__c =’0010K00002NezhdQAB’
When designing any system, it’s always important to consider the volume. As a developer, data storage is a common issue you will run into. But big objects help us to maintain an enormous amount of data without hindering the performance of the system. Big objects provide us with the flexibility to store large amounts of data without worrying about storage capacity. Salesforce Big Objects can help businesses and developers manage large amounts of data. If you still need assistance with your Salesforce Big Objects, feel free to reach out to us. We can provide a free consultation or discuss our Salesforce implementation and consultation services.
For educational videos be sure to visit our YouTube channel where you can check out quick videos and how-tos for all things Salesforce. While you’re there don’t forget to subscribe! You can also subscribe to our blog to receive weekly updates on the Salesforce topics you want to hear about.
Nidhi is a talented Salesforce Developer. She has strong development and management skills and is always eager to meet the challenge of new territories in her roles. She has a passion to continuously achieve her goals and learn.
We’re an Austin-based Salesforce Consulting Partner, with a passion and belief that the Salesforce platform’s capabilities can help businesses run more efficiently and effectively. Whether you are just getting started with Salesforce or looking to realize its full potential, Roycon specializes in Salesforce Implementations, Salesforce Ongoing Support, and Salesforce Integrations, and Development. We’re the certified partner to guide the way to increase Salesforce Adoption, make strategic decisions, and build your Salesforce Roadmap for success.