How to filter date field in SOQL?

Date format is very important when we use date field in SOQL.

Sample Query:

SELECT Name, Joining_Date__c FROM Order_Line_Items__c WHERE Joining_Date__c = 2014-02-03


Cheers!!!

toLabel()


toLabel() is used to convert the results of particular field into user’s language. All the organizations can use toLabel(). toLabel() helps a lot for the organization where translation workbench is enabled.

Note: Translation workbench is used to specify in what are all the languages the configurations done in your organization can be translated.

Sample SOQL query:
SELECT Name, toLabel(Industry) FROM Account


As a subtab of in Service console App

While creating Service Console App, we get an option to select  As a subtab of which object. This denotes which parent record should be automatically opened when we open the child record.

For example, if we make Account as a sub tab of Contact, whenever we create Contact record, its associated Account record will be automatically created to its right in a separate tab.

Cheers!!!

Edit, Delete and Clone Buttons in Salesforce

Edit
Edit button is used to modify the record.

Delete
Delete button is used to delete the record. Deleted record will stay in Recycle bin for 15 days.

Clone
Clone button is used to create an exact copy of the record.

Difference between apex:pageMessage and apex:pageMessages

apex:pageMessage
apex:pageMessage is used for displaying custom messages in the visualforce page using the Salesforce pattern for errors, warnings and other types of messages for a given severity.

apex:pageMessages
apex:pageMessages displays all the messages that were generated for all components on the current visualforce page, presented using the Salesforce styling.

Different APIs supported in Salesforce


Different APIs supported by Salesforce.com are

REST API
Accessing objects in your organization using REST.
SOAP API
Integrating your organization’s data with other applications using SOAP.
Chatter REST API
Accessing Chatter feeds and social data such as users, groups, followers, and files using REST.
Bulk API
Loading or deleting large numbers of records.
Metadata API
Managing customizations in your organization and building tools that can manage the metadata model, not the data itself.
Streaming API
Providing a stream of data reflecting data changes in your organization.
Apex REST API
Building your own REST API in Apex. ExposesApex classes as RESTful Web services.
Apex SOAP API
Creating custom SOAP Web services in Apex. Exposes Apex classes as SOAP Web services.
Tooling API
Building custom development tools forForce.com applications.

APIs act as Web services interface for interacting with Salesforce.

REST API

REST API is mainly used for  ease of integration and development. It supports smaller sets of data.

SOAP API

SOAP API cab be written in any language that supports Web services.
For example, you can use SOAP API to integrate Salesforce with your organization’s ERP and finance systems, deliver real-time sales and support information to company portals, and populate critical business systems with customer information.

Chatter REST API

Chatter REST API provides programmatic access to Chatter feeds and social data such as users, groups, followers, and files.

Bulk API

Bulk API is based on REST principles and is optimized for loading or deleting large sets of data.
Bulk API is designed to process data from a few thousand to millions of records.
The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. This avoids the need to write your own client application.

Use Metadata API

Use Metadata API to retrieve, deploy, create, update, or delete customizations for your organization. The most common use is to migrate changes from a sandbox or testing organization to your production environment. Metadata API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself.
The easiest way to access the functionality in Metadata API is to use the Force.com IDE or Force.com Migration Tool.

Streaming API

Use Streaming API to receive notifications for changes to data that match a SOQL query that you define.
Streaming API is useful when you want notifications to be pushed from the server to the client. Consider Streaming API for applications that poll frequently. Applications that have constant polling action against the Salesforce infrastructure, consuming unnecessary API call and processing time, would benefit from this API which reduces the number of requests that return no data.Streaming API is also ideal for applications that require general notification of data changes. This enables you to reduce the number of API calls and improve performance.

Apex REST API

Use Apex REST API when you want to expose your Apex classes and methods so that external applications can access your code through REST architecture. Apex REST API supports both OAuth 2.0 and Session ID for authorization.

Apex SOAP API

Use Apex SOAP API when you want to expose your Apex methods as SOAP Web service APIs so that external applications can access your code through SOAP. Apex SOAP API supports both OAuth 2.0 and Session ID for authorization.

Tooling API

Use Tooling API when you want to manage and deploy working copies of Apex classes and triggers and Visualforce pages and components, set checkpoints or heap dump markers, execute anonymous Apex, and access logging and code coverage information.

FOR VIEW in SOQL

FOR VIEW is used to notify Salesforce when a record is viewed. The LastViewedDate field is updated for any retrieved records.

Sample Query:

SELECT City__c, State__c, LastViewedDate FROM Employee__c FOR VIEW

If we execute the above query, for the first time, it shows the lastly viewed date of the record in LastViewedDate. But for the second time, all the records will show the same date and time (date and time when we executed the query for the first time) for LastViewedDate.

Cheers!!!

FOR REFERENCE in SOQL

FOR REFERENCE is used to notify Salesforce when a record is referenced. The LastReferencedDate field is updated for any retrieved records.

Sample Query:

SELECT City__c, State__c, LastReferencedDate FROM Employee__c FOR REFERENCE

If we execute the above query, for the first time, it shows the lastly referenced date of the record in LastReferencedDate. But for the second time, all the records will show the same date and time (date and time when we executed the query for the first time) for LastReferencedDate.

Cheers!!!

Batch Class has zero % code coverage

This is a known issue in Salesforce.

Kindly follow the below link for workaround

https://success.salesforce.com/issues_view?id=a1p30000000T0kUAAS

Note:
1. Kindly check whether @isTest notation is added.
2. Go to Setup --> Apex Test Execution --> View Test History and click "Clear Test Results" button.

After following the above steps, if the problem persists,


Kindly use following troubleshooting steps:

  1. Disable Parallel Apex Testing
  2. Clear apex test execution history 
  3. Compile all classes
Cheers!!!

Formulas in Report Builder

Formulas let you create custom summaries based on calculated values using report data. These formulas can then be used as columns in your report.

To add a new formula to a summary or matrix report, double-click Add Formula. Once you define it and click OK, it's automatically added to the preview as a column for summary reports, and a summary field for matrix reports. With joined reports, you can add either a cross-block or a standard custom summary formula.


How to write a test class for a controller which gets id from the url?

Sample Code:

Account acct = new Account(Name = 'Test');
insert acct;

apexpages.currentpage().getparameters().put('Aid' , acct.Id);
Class_Name controller = new Class_Name() ;

Cheers!!!

Force.com site in Salesforce

Force.com Sites is mainly used when we want to publish our data to the world using Visualforce pages. Force.com Sites also allows you to authenticate access to specific pages that expose data from your internal database.

To create Force.com Site,

1. Go to Setup --> Build --> Develop --> Sites.


2. Click "New" button.

3. Enter the details and click "Save" button.


4. Use the default web address to open the site.

Note: Kindly open the default web address in some other browser to view it.

What is List Price?

List Price is the expected maximum retail price of the product which is decided by the Manufacturer.

The price of the product without any discounts is nothing but List Price.

Cheers!!!

How to restrict price books to users?


1. Go to Setup --> Security Controls --> Change the access as "No Access" to Price Book object.


2. Open the Price Book record.

3. Click "Sharing" button.


4. Click "Add" button to add the users.


Alias Notation in SOQL

Sample SOQL:

SELECT FirstName, LastName FROM Contact Con, Con.Account Acct WHERE Acct.Name = 'Infallible'