Force.com IDE is not searching properly

Go to Search or press CTRL + H.


Click "Choose" button to include the components to be searched.

Cheers!!!

Spring ‘14 Certification Maintenance

Developer Exam:

Training Link:

Release Notes:

You will have 3 attempts to pass the exam. There are 5 exam questions and the passing score is 80%.

Administrator Exam:

Training Link:

Release Notes:

You will have 3 attempts to pass the exam. There are 13 exam questions and the passing score is 70%.

Cheers!!!

How to remove duplicates from list in Salesforce?

Create a map instead of list and finally insert or update the map values.

Sample Code:

Map<Id, Account> mapAccount = new Map<Id, Account>();

for(Account acc : listAccount){
...............
...............
mapAccount.put(acc.Id, acc);
}

update mapAccount.values();

How to see the overall code coverage in Salesforce.com?

Go to Setup --> Apex Classes --> Estimate your organization's code coverage.


Cheers!!!

Query Error: "System.QueryException: Non-selective query against large object type"

To avoid "Query Error: "System.QueryException: Non-selective query against large object type"" exception, follow the below steps

1. Make sure that your SOQL doesn't have null values in set or list or in a variable while fetching.

2. Don't use negative operator such as NOT EQUAL TO (or !=), NOT CONTAINS, and NOT STARTS WITH in SOQL to fetch records.

3. Avoid using Formula field for filtering in SOQL.

4. If you use IN operator, make sure that the field is indexed.

5. If a field is not indexed, kindly contact Salesforce.com to do custom index on the field.

6. Empty your Organization Recycle Bin.

Note:

1. By default, Lookup, Master Detail and external id fields are indexed.

2. For custom indexing, kindly contact Salesforce.com support.

Check this link for more info

https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm

Cheers!!!

How to clone a record using apex in Salesforce?

clone(Boolean, Boolean, Boolean, Boolean):

Creates a copy of the sObject record.

Parameters
opt_preserve_id
Type: Boolean
 Determines whether the ID of the original object is preserved or cleared in the duplicate. If set to true, the ID is copied to the duplicate. The default is false, that is, the ID is cleared.

opt_IsDeepClone
Type: Boolean
Determines whether the method creates a full copy of the sObject field, or just a reference:
If set to true, the method creates a full copy of the sObject. All fields on the sObject are duplicated in memory, including relationship fields. Consequently, if you make changes to a field on the cloned sObject, the original sObject is not affected.
If set to false, the method performs a shallow copy of the sObject fields. All copied relationship fields reference the original sObjects. Consequently, if you make changes to a relationship field on the cloned sObject, the corresponding field on the original sObject is also affected, and vice-versa. The default is false.


opt_preserve_readonly_timestamps
Type: Boolean
Determines whether the read-only timestamp fields are preserved or cleared in the duplicate. If set to true, the read-only fields CreatedById, CreatedDate, LastModifiedById, and LastModifiedDate are copied to the duplicate. The default is false, that is, the values are cleared.

opt_preserve_autonumber
Type: Boolean
Determines whether auto number fields of the original object are preserved or cleared in the duplicate. If set to true, auto number fields are copied to the cloned object. The default is false, that is, auto number fields are cleared.

Note: All the parameters are optional.

Sample Code:

Employee__c e = [SELECT Name, Age__c, Department__c FROM Employee__c LIMIT 1];

Employee__c eCopy = e.clone(false, false, false, false);

if you insert eCopy, it will be the exact copy of e.

How to make a date field null in Salesforce?

Sample Code:

Date Due_Date__c = null;

Cheers!!!

How to show report chart in Visualforce page?

Sample code:

<apex:page sidebar="false" >
     <analytics:reportChart ReportId="00OU0000001pO02" showRefreshButton="true" size="huge" cacheResults="false" />
</apex:page>

Output:




Cheers!!!

Test class for Abstract class in Salesforce

Abstract Class:

public abstract class SampleAbstract
{
    public Task newTask;
    public void createT(Id caseId, Id accountId)
    {
        newTask = new Task();
       
        methodX();
        methodY();
    }
   
    public abstract void methodX();
    public abstract void methodY();
}

Class extending Abstract class:

public class Sample extends SampleAbstract {  
   
    public sample() {
    }
   
    public override void methodX(){
    }
   
    public override void methodY(){
    }  

}

Test class:

@isTest
private class AbstractTest{
    static testMethod void test(){
        Sample sa = new Sample();  
           
        Id caseId;
        Id accountId;
        sa.createT(caseId, accountId);  
    }
}

How to call abstract class methods in Salesforce?

Abstract Class:

public abstract class SampleAbstract
{
    public Task newTask;
    public void createT(Id caseId, Id accountId)
    {
        newTask = new Task();
       
        methodX();
        methodY();
    }
   
    public abstract void methodX();
    public abstract void methodY();
}

Class extending Abstract class:

public class Sample extends SampleAbstract {  
   
    public sample() {
    }
   
    public override void methodX(){
    }
   
    public override void methodY(){
    }  

}

Test class:

@isTest
private class AbstractTest{
    static testMethod void test(){
        Sample sa = new Sample();  
           
        Id caseId;
        Id accountId;
        sa.createT(caseId, accountId);  
    }
}

How to schedule data export in Salesforce using Dataloader.io?

1. Go to dataloader.io.

2. Click "Login With Salesforce" button.


3. Select the Environment and click "Login" button.


4. Enter the username and password and click "Login in to Salesforce" button.


5. Under Task, select Export.


6. Select the object and click "Next" button.


7. Select the fields and click "Next" button.


8. Schedule it and click "Save and Run" button.


Salesforce opening


Jeevan Technologies is looking for Salesforce professionals.

Kindly forward your resume to "hrd@jeevantechn­ologies.com".

Source: http://www.meetup.com/ChennaiSalesforceDeveloperGroup/members/143147962/

Good Luck!!!

How to execute a piece of code in Apex and view the result?

1. Go to Workbench and select Apex Execute.


2. Enter the code and click "Execute" button to view the result.


How to convert 15 digit Id to 18 digit id in Formula field in Salesforce?

CASESAFEID( ) is used to convert 15 digit Id to 18 digit id in Formula field in Salesforce

Cheers!!!

Difference between apex:selectOption and apex:selectOptions in Salesforce?


apex:selectOption:
If we are sure about the values, we can make use of apex:selectOption.

Sample Code:

<apex:selectList >
     <apex:selectOption itemValue="Apple" itemLabel="Apple"/>     
     <apex:selectOption itemValue="Orange" itemLabel="Orange"/>
     <apex:selectOption itemValue="Banana" itemLabel="Banana"/>
</apex:selectList>

apex:selectOptions:
If we are unsure about the values, we can make use of apex:selectOptions and we can fetch the values from our controller.

Sample Code:
<apex:selectOptions value={!ListofValues}/>

Cheers!!!

Difference between selectOption and selectOptions in Salesforce?

apex:selectOption:
If we are sure about the values, we can make use of apex:selectOption.

Sample Code:

<apex:selectList >
     <apex:selectOption itemValue="Apple" itemLabel="Apple"/>     
     <apex:selectOption itemValue="Orange" itemLabel="Orange"/>
     <apex:selectOption itemValue="Banana" itemLabel="Banana"/>
</apex:selectList>

apex:selectOptions:
If we are unsure about the values, we can make use of apex:selectOptions and we can fetch the values from our controller.

Sample Code:
<apex:selectOptions value={!ListofValues}/>

Cheers!!!

How to show external website inside Visualforce page?

Sample Code:

<apex:page sidebar="false" >
    <apex:iframe height="300" width="300" src="http://www.infallibletechie.com" scrolling="true"/>
</apex:page>

Output:


How to add console components in Salesforce

To add console components, go to Setup --> Customize --> Console --> Custom Console Components.


How to change the Activity columns in the related list?

1. Edit the page layout.

2. Click the gear icon.


3. Re-arrange the fields.


How to find how many SOQL queries are executed at a point using Apex in Salesforce?

getQueries() 
getQueries() returns the number of SOQL queries that have been executed as of now.

Cheers!!!

API is not enabled for this organization or partner error

For Professional Edition, API is not allowed. So, kindly upgrade your Salesforce organization.

Cheers!!!

File only saved locally not to server issue in Force.com IDE

1. Check whether you are working in OFFLINE mode.


2. Check whether Build Automatically is selected.


Force.com IDE installation for Eclipse Kepler Version

1. Go to Help --> Install New Software.


2. Click "Add" button to add a local repository.


3. Give the name as "Force.com IDE" and URL as "http://media.developerforce.com/force-ide/eclipse42".


4. Select "Force.com IDE" and click "Next" Button.


5. Click "Next" Button.


6. Accept the Terms and Agreement.


How to allow DML operations in apex:component in Salesforce?

In order to allow DML operations in apex:component, allowDML attribute should be made true.

Sample Code:

<apex:component controller="TearPagesController" allowDML="true">

System.LimitException: DML currently not allowed

DML operations are not allowed

1. Inside the constructor.

2. Method which is called from the constructor.

3. Check whether allowDML="true" is set in your apex:Component.

Cheers!!!

Different deployment ways in Salesforce

The different deployment ways in Salesforce are
  1. Changeset
  2. Workbench
  3. ANT
  4. Force.com IDE

Exception handling in Salesforce

Kindly use the below link for Exception handling in Salesforce

https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling

Cheers!!!

How to change the owner to the default owner when transferring records from one org to another using SALESFORCE TO SALESFORCE?

ConnectionReceivedId is the ID of the PartnerNetworkConnection that shared record with your organization.

So, write a trigger on before insert that owner should be changed to default owner, when ConnectionReceivedId is not null.

Cheers!!!

SOQL Study Guide

If you want to learn SOQL advance concepts, make use of the below link

http://www.packtpub.com/getting-started-with-soql/book

This book will be very helpful for DEV 501 certification preparation.

Note: Kindly refer this to your friends who are interested and preparing for Salesforce certification.

Cheers!!!

SOQL Material

If you want to learn SOQL advance concepts, make use of the below link

http://www.packtpub.com/getting-started-with-soql/book

This book will be very helpful for DEV 501 certification preparation.

Note: Kindly refer this to your friends who are interested and preparing for Salesforce certification.

Cheers!!!

Salesforce MVP nomination

Kindly use the below link for Salesforce MVP nomination


Cheers!!!

How to avoid concurrent batch execution in Salesforce?

Sample Code:

if ([SELECT count() FROM AsyncApexJob WHERE JobType='BatchApex' AND (Status = 'Processing' OR Status = 'Preparing')] < 1]){
   Database.executeBatch(batchClassInstance);
} else {
   Schedulable_Class sc = new Schedulable_Class();
   Datetime dat = Datetime.now().addMinutes(30); // This is for 30 mins delay
   String timeForScheduler = dat.format('s m H d M \'?\' yyyy');
   Id scheduleId = System.Schedule('Trying again' + timeForScheduler, timeForScheduler,sc);
}

Cheers!!!

How to get batch status using Apex code?

Sample Code:

    public String status {get;set;}
    Id batchId;

/*Method to call the batch class*/
public void startBatch(){
        batchAccountUpdate obj = new batchAccountUpdate();
        batchid = Database.executebatch(obj);
    }
    
/*Method to check the status of batch*/
    public void checkStatus(){
        AsyncApexJob aaj = [SELECT Status FROM AsyncApexJob WHERE ID =: batchId];
                    
        status = aaj.Status;
    }

Cheers!!!

Salesforce Releases per year

Salesforce.com Releases per year are as follows
    1)  Spring (February to May)

    2)  Summer(June to September)

    3)  Winter(October to January)
      The exact dates of the releases are published a month or so in advance.

      https://trust.salesforce.com is the best place to find out the exact date for a particular release.

      Cheers!!!

      How to delete recycle bin data in Salesforce?

      Purge option in Workbench.developerforce.com is used to delete the recycle bin data from you Salesforce.com organization.

      To login into workbench, kindly use the below link.

      http://www.infallibletechie.com/2013/10/workbench-in-salesforce.html

      Below steps are used to purge the records

      1. Select "Purge" option.



      2. Have a CSV file with deleted record ids.


      3. Choose the file and click "Next" button.


      4. Map the fields and click "Map Fields" button.


      5. Click "Confirm Purge" button to purge.


      Output:



      Purge in Workbench.developerforce.com


      Purge option in Workbench.developerforce.com is used to delete the recycle bin data from you Salesforce.com organization.

      To login into workbench, kindly use the below link.

      http://www.infallibletechie.com/2013/10/workbench-in-salesforce.html

      Below steps are used to purge the records


      1. Select "Purge" option.


      2. Have a CSV file with deleted record ids.



      3. Choose the file and click "Next" button.


      4. Map the fields and click "Map Fields" button.


      5. Click "Confirm Purge" button to purge.


      Output: