Big Object

We may already have heard that we can’t make API calls directly from Lightning Components, and that those calls must be made via Apex. Well, today I needed to call the Tooling API from Apex, so I started coding something that I thought would be simple.

Introduction

Big object is the object in which we can store up to one billion records. We can archive large amount of historical data in Salesforce.

When to use Big Object:

  • If you have the large amount of data to be archived for the historical data
  • Performing the analysis of live and historical data.
  • Tracking an event with the help of event monitoring.

Types of big Objects:

  • Standard big objects (FieldHistoryArchive): It stores large amount of data as part of Field Audit Trail.
  • Custom big objects: It will be created by appending api name with ‘__b’.

Consideration

  • Big object cannot be created through the UI. It can be created via Metadata API.
  • Big Object supports Visualforce page and Lightning components.
  • Once a big object is deployed to Salesforce, we can change some of the attributes like label name, API name, etc. We cannot change the datatype.
  • Big Object does not support sharing rules, trigger, flows, processes, and Salesforce Apps.
  • We can create up to 100 big objects per org. Field limits is like custom object field limitation.
  • We can check the storage status by Setup > Data Management > Storage Usage.
  • Big data cannot be accessed from Salesforce Connect external objects.
  • Big Data identifies each record with its indexes to avoid duplicate records.
  • Big Object support following data types
    • Text
    • Number
    • Date Time
    • Lookup
    • Long Text Area
  • We can create or update big object records in Apex using insertImmediate method and delete the big object records by using deleteImmediate

Create and deploy big object

  • Create an .xml file for objects to define object and its custom field metadata and permission sets to give field level security access for the big object metadata as shown below:
  • We can deploy objects set in following way:
    • Through workbench
      • Log into Workbench. Authorize Workbench to access Salesforce Information by clicking Allow (if prompt).
      • Under Migration, click on Deploy.
      • Create a zip file which contains objects, Permission Sets, profiles and package.xml files. Upload the zip file by clicking choose file button.
      • Click Next > Deploy.
      • Big Object
  • Through Force.com IDE:
    • Create a big object file under the objects folder as shown in image below,

Big Object

  • Define the field definition

Big Object

  1. Create the custom fields definition.
  2. Make sure you have defined the indexes; it should be required field.
  • Under the objects, click on the big object you created. Right click and choose com > Save to Server option.

Big Object

  • It will be deployed to your developer instance.

Access to Big Object:

By default, fields are not accessible; we should give access from profile or permission set.

  • Go to Setup à Search “Big Objects” in quick find à Big objects.
  • Big Object
  • List of big objects will be shown here

Big Object

You cannot change the data type for the custom fields. Once it is defined and deployed to Salesforce, neither we can change the data type, nor we can delete the custom fields.

Following data types are currently supported with big object:

  • Text
  • Number
  • Lookup
  • Date time
  • Long Text Area

Record creation in Big object:

We can insert the records in big object in the following ways:

  • Through Data loader
    • Create csv files and insert the record through the data loader.

Big Object

  • Through Apex code:
    • We can insert the record with the help of insertImmediate DML operation.
    • Below is the sample code to insert the data for each account records.
    • If the data exists already, it will update the data.

Big Object

Conclusion

Big object is used to store and manage the large amount of data effectively in Salesforce.

Reference:

Trailhead link: Big Object Basics

Implementation guide: Big Objects

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.