Author Archives: Biswajeet

About Biswajeet

Biswajeet is my Name, Success is my Aim and Challenge is my Game. Risk & Riding is my Passion and Hard Work is my Occupation. Love is my Friend, Perfection is my Habit and Smartness is my Style. Smiling is my Hobby, Politeness is my Policy and Confidence is my Power.

Salesforce Apex Scheduler

  • To invoke Apex classes to run at specific times, first implement the Schedulable interface for the class. Then, schedule an instance of the class to run at a specific time using the System.schedule method.
  • The class implements the Schedulable interface and must implement the only method that this interface contains, which is the execute method.
  • The parameter of this method is a SchedulableContext object. After a class has been scheduled, a CronTrigger object is created that represents the scheduled job. It provides a getTriggerId method that returns the ID of a CronTrigger API object.

Sample Code:

global class AccountBatchScheduled implements Schedulable {
    global void execute(SchedulableContext ctx) {
        //Batch class scheduled using Schedulable interface
        Database.executebatch(new AccountBatch());
    }
}

There are 2 ways to schedule an apex job:

  • Scheduling a Job from the UI
  • Using the System.Schedule Method

External Ids in Salesforce

What is External Ids?
An External Id is a custom field that has the “External Id” attribute, meaning that this filed is a primary key and it contains unique record identifiers from a system outside of Salesforce. Salesforce allows up to 3 fields as External Id and these fields must be text, number or email field types.
What is the use of External Ids?
Basically we use “External Id” to match on for updates. When we perform upsert or update, we can match on this “External Id” field. External Id is a manual record Id will be used to integrate with external system.

What is the advantage of External Ids?

  • The import wizard will detect existing records in Salesforce that have the same External Id.
  • When using the upsert command during data loading, we can reference the External Id field instead of the Salesforce Id.
  • When we load data from external systems, We can use External Ids to prevent duplicate records from being created as a result of the import operation.
  • Fields marked as External Ids are searchable in the sidebar search.

Difference Between Role & Profile in Salesforce

Profile:

  • A Profile is a collection of settings and permissions that controls the user what they have to do in the application and with access what they have.
  • A profile controls “Object permissions, Field permissions, User permissions, Tab settings, App settings, Apex class access, Visualforce page access, Page layouts, Record Types, Login hours & Login IP ranges.
  • Defining profile for a user is mandatory.

Role:

  • A role controls the level of visibility that users have into your organization’s data. Mainly is going to provide the record level security.
  • Users at any given role level can view, edit, and report on all data owned by or shared with users below them in the hierarchy, unless your organization’s sharing model for an object specifies otherwise.
  • It is not mandatory that a user should have a role.

Important Points to Remember in Salesforce

Important Points to Remember in Salesforce:

  • We can track 20 fields for an object. We can’t track Roll-Up Summary and formula fields. We can’t create Roll-Up Summary field on User object.
  • Capacity of picklist values are 300.
  • Lenght of Check syntax: 4000 characters
  • Length of the formula: 1300 characters. Size of the formula: 5000 bytes
  • Only 10 Roll-Up Summary fields we can create per an object. We can create Roll-Up Summary field on parent object to perform operations on child object.
  • Roll-Up Summary field performs 4 types of operations on child object. They are 1.Count 2.Sum 3.Min 4.Max.
  • We can add 20 components for a dashboard.
  • We can display 1000 records on each visualforce page.
  • PageBlockSectionItem will take only 2 visualforce components.
  • Standard fields are Owner, Name, Created By, Last Modified By, Currency, Division.
  • We can’t create Look-Up or Master-Detail Relationship on User Object.

Difference between __c and __r in Salesforce

__c is for Custom objects For example: Custom_Object__c . It is used for reference custom object in Apex or visualforce page, formula field etc internally. Used as suffix.

__r is for Custom objects reference For example: Custom_Object__r . It is used for reference custom object relationship name in Apex or visualforce page, formula field etc. Used as suffix.