Thursday, 22 March 2018

Big Object in Salesforce | Difference Between Custom Object and Big Object



What is Big Object :-

Object that stores and Manages Massive data values within Salesforce Without affecting performance. Big objects provide consistent performance for a billion records, and are accessible with a standard set of API's to your org or external system.

Custom big objects can be created by the Metadata API. To define a custom big object, you need to create an object file that contains its definition, field's, and index, with a Permission-set to define the permissions for each field, and  package file to define the contents of the object metadata


What Should Consider for Big Object

1) You need to use Metadata API to create Big Object.
2) Max 100 Big objects per org
3) Support's Date Time,Lookup,Number,Text,Long Text Area Field only
4) triggers, flows, processes, and the Salesforce app are unavailable.
5) Async SOQL is included only with the licensing of additional big object capacity
6) Support only object and field permissions
7) Does not Count against org data Storage limit
8) Suffixed with "_b".


Step to Create Big Object:-

You need to create the below three files.

Step 1) Create Big Object Files:-  

1) Create an Object File :- Defines the custom big object’s fields and index, Each custom big object needs its own object file.

My_First_Big_Object__b.object


<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <deploymentStatus>Deployed</deploymentStatus>

    <fields>
        <fullName>MyTextField__c</fullName>
        <label>My Text Field</label>
        <length>16</length>
        <required>false</required>
        <type>Text</type>
        <unique>false</unique>
    </fields>
   
    <fields>
        <fullName>Account_Lookup__c</fullName>
        <label>Account Lookup</label>
        <referenceTo>Account</referenceTo>
        <relationshipName>Account_Lookup</relationshipName>
        <required>true</required>
        <type>Lookup</type>
    </fields>
   
    <fields>
        <fullName>Date_Time__c</fullName>
        <label>Date Time</label>
        <required>true</required>
        <type>DateTime</type>
    </fields>
   
    <fields>
        <fullName>Number_Field__c</fullName>
        <label>Number Field</label>
        <required>false</required>
        <type>Number</type>
        <scale>2</scale>
        <precision>16</precision>
    </fields>

    <indexes>
        <fullName>MyFirstBigIndex</fullName>
        <label>My First Big Index</label>
        <fields>
            <name>Account_Lookup__c</name>
            <sortDirection>DESC</sortDirection>
        </fields>
        <fields>
            <name>Date_Time__c</name>
            <sortDirection>DESC</sortDirection>
        </fields>
    </indexes>
   
    <label>My First Big Object</label>
    <pluralLabel>My First Big Object</pluralLabel>
   
</CustomObject>


2) Create A Permissionset file :- with a Permissionset to define the permissions for each field

My_First_Big_Object.permissionset


<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
    
    <fieldPermissions>
        <editable>true</editable>
        <field>My_First_Big_Object__b.MyTextField__c</field>
        <readable>true</readable>
    </fieldPermissions>
        
    <fieldPermissions>
        <editable>true</editable>
        <field>My_First_Big_Object__b.Number_Field__c</field>
        <readable>true</readable>
    </fieldPermissions>
    
    <label>My_First_Big_Object Permission Set</label>
   
</PermissionSet>




3) Create package.xml file :-  file to define the contents of the object metadata

package.xml


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>PermissionSet</name>
    </types>
    <version>41.0</version>
</Package>



Step 2) Deploy big object :-

1) Create the zip file for deployment.
Save all three file in one folder. Create the folder Structure like below



Add My_First_Big_Object__b.object file in Object Folder

Add My_First_Big_Object.permissionset file in permissionset Folder

package.xml file should in root of the folder.

2) Deploy with the help of Workbench or ANT tool.

2.1) Login on workbench
2.2) Click on Migration tool in workbench and select Single Package option like below image.



2.3) Now validate the big object in your Salesforce org.



How to insert a record 



My_First_Big_Object__b obj = new My_First_Big_Object__b();
obj.Account_Lookup__c ='0019000001ukhMF';
obj.Date_Time__c=System.now();
obj.MyTextField__c='hello';
obj.Number_Field__c=10;
database.insertImmediate(obj);


Query a record


 Difference Between Custom Object and Big Object



Custom Object
Big Object
Create
Manual and Metadata
Metadata
API Name
__c
__b
Track Activity
Yes
No Option
Field History Tracking
Yes
No Option
Data Type
All
Text, Date Time, Lookup, Number, Long Text Area
Edit Field
Yes
Yes
Delete Field
Yes
No
Trigger
Yes
No
Report
Yes
No
Storage
It Count Against Storage
It doesn’t count against Storage


Recently we did the session on Big Object in Salesforce Apex Hours.

Recording :- https://www.youtube.com/watch?v=gV1Oviqzry0&t=4691s



Please check below Trailhead module for more detail
1) https://trailhead.salesforce.com/en/modules/big_objects

Thanks
Amit Chaudhary

Saturday, 24 February 2018

Salesforce Apex Hours

Hello Everyone !

"Salesforce Apex Hours" is a recurring event to talk about Salesforce ! Some times we'd like to meet on one location and some time online. We are happy that we completed 3 successful Online event in last three week on below topic :-
 
  1. Big Object
  2. Spring 18 Lightning Component Framework Updates
  3. Introduction to External Services


Please join / subscribe our YouTube Channel for old and future recording.
Link :- https://www.youtube.com/channel/UChTdRj6YfwqhR_WEFepkcJw/videos

All PPT are hosted here.
Link :- https://www.slideshare.net/AmitChaudhary112/


Our Upcoming session :-
  1. Lightning Testing Service (LTS) ( March 10, 2018 )
  2. Basics of Analytics Wave  ( March 24, 2018 )
  3. SSIS integration with Salesforce ( April 7, 2018 )

Dnt forget to RSVP. Click here for RSVP


Please feel free to share your feedback to us on my email id .


Thanks,
Amit Chaudhary
amit.salesforce21@gmail.com.





Thursday, 4 January 2018

Salesforce DX | Change a Password for a Scratch Org in Salesforce

Change a Password for a Scratch Org User




In our last post we learn about how to install Salesforce DX and how to create Scratch org with salesforce DX,

What is Scratch Org ?

A Scratch org is a dedicated , configurable and short term Salesforce org that you can quickly spin - up when starting a new project , new feature branch and feature Test.


Create Password for Scratch org

When we create a scratch org using command line it does not show password. But if you need  password for your scratch org then try below command.

Step 1) Generate password

sfdx force:user:password:generate -u <Alise_Org_Name>


sfdx force:user:password:generate -u MyFirstScratch






Step 2) To see the password again.

sfdx force:org:display -u MyFirstScratch




Please share your feedback and comment


Thanks
Amit Chaudhary
@amit_sfdc