How to enable Lightning in Salesforce?

1. Go to "Lightning Experience".


2. Enable Lightning Experience.


3. Click "Continue to Lightning Experience".


4. Select "Switch to Lightning Experience".


5. Confirm Switch to Lightning Experience.


Enjoy the Lightning Experience!!!

Cheers!!!

How to get Apex Classes names in Salefsforce?

Below query is used to get Apex Classes names in Salefsforce.

SOQL:

SELECT Name, Body FROM ApexClass

One more approach is use Ant tool to fetch all Apex Classes with the below Package.xml.

  <types>
        <members>*</members>
<name>ApexClass</name>
    </types>

To get the names of the retrieved Apex Classes, use the below link

http://www.infallibletechie.com/2014/10/how-to-copy-all-files-names-from-folder.html

Cheers!!!

How to avoid focusing to Date or text field in a Visualforce page?

Add the below code in the Visualforce page to avoid focusing to Date or text field.

    <script>
        window.onload = function(){
            window.scrollTo(0,0);
        };
    </script>


Cheers!!!

Compound Fields in Salesforce

Compound fields group together multiple elements of primitive data types, such as numbers or strings, to represent complex data types, such as a location or an address. Compound fields are an abstraction that can simplify application code that handles the values, leading to more concise, understandable code.

Address compound fields are available in the SOAP and REST APIs in API version 30.0 and later. Geolocation fields are available in the SOAP and REST APIs in API version 26.0 and later, with some limitations on SOAP for API versions below 30.0.

Example:

BillingAddress, MailingAddress.

Cheers!!!

Salesforce Certified Platform Developer I Transition Exam

Salesforce Certified Platform Developer I Transition Exam consists of 15 questions. This is applicable only for people who have already completed Salesforce.com certified Force.com Advanced Developer Multiple choice questions.

Only 3 attempts are allowed.

Download the study guide and go through all the links given in it.

Note:

1. Many questions were part of Governor Limits.

2. Concentrate more on Lightning.

3. Study about Static and Final keywords.

4. Learn Order of Execution.

5. Focus on Schema Builder features.

6. Give importance to Process Builder.

Cheers!!!

How to update classes even when they are scheduled in Salesforce?

Sample Batch Class:

global class AccountUpdateBatch implements Database.Batchable <sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc) {
        String SOQL = 'SELECT Id, Description FROM Account';
        return Database.getQueryLocator(SOQL);
    }
    
    global void execute(Database.BatchableContext bc, List<Account> listAcct) {
        for(Account acct : listAcct) {
            acct.Description = String.valueOf(system.today());
        }
        update listAcct;
    }
    
    global void finish(Database.BatchableContext bc) {
    }
}

Scheduler Class:

global class AccountUpdateScheduler Implements Schedulable {
    public Interface AccountUpdateSchedulerInterface {
        void execute(SchedulableContext sc);
    }
    global void execute(SchedulableContext sc) {
        Type targetType = Type.forName('AccountUpdateBatchSchedulerHndlr');
        if(targetType != null) {
            AccountUpdateSchedulerInterface obj = (AccountUpdateSchedulerInterface)targetType.newInstance();
            obj.execute(sc);
        }
    }
}

Scheduler Handler Class:

public class AccountUpdateBatchSchedulerHndlr implements AccountUpdateScheduler.AccountUpdateSchedulerInterface {
    public void execute(SchedulableContext sc) {
        AccountUpdateBatch obj = new AccountUpdateBatch();
        Database.executeBatch(obj);
    }    
}

To check whether the batch class is executed by scheduling the scheduler class, execute the below code in Developer console or in Workbench.

        Datetime dt = Datetime.now().addMinutes(1);
        String CRON_EXP = '0 '+ dt.minute() + ' * ' + dt.day() + ' ' + dt.month() + ' ? ' + dt.year();
        String jobId = System.schedule('AccountUpdateScheduler', CRON_EXP, new AccountUpdateScheduler() ); 

Schedule the AccountUpdateScheduler class and try to update the handler class or batch class. We will not get any error stating that dependent class is scheduled.

Cheers!!!

How to dynamically pass From and To date in Time Frame section in Report in Salesforce?

colDt_s and colDt_e are used to dynamically pass From and To date in Time Frame section in Report in Salesforce.

Sample Code:

String reportURL = '/{!ReportId}?colDt_s={!DateField}&colDt_e={!DateField}';
Check the below links for dynamic parameter passing to reports in Salesforce

http://www.infallibletechie.com/2014/02/how-to-change-report-criteria.html

http://www.infallibletechie.com/2014/07/how-to-create-dynamic-filter-fields-and.html

http://www.infallibletechie.com/2014/05/dynamic-filters-for-reports-in.html

Cheers!!!

Salesforce Developer Opening in US

Senior Developer Needed in NYC!

Check the below link for more info,

https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000BU0MIAW

Send an email to nancy@tech2resources.com to grab the wonder opportunity with more benefits.

Cheers!!!

How to create Opportunity Line Item using Apex in Salesforce?

Sample Code:

OpportunityLineItem OLI = new OpportunityLineItem();
OLI.OpportunityId = oppty.Id; //Opportunity Id has to be assigned
OLI.PricebookEntryId = PBE.Id; //PriceBookEntry Id for that Product should be assigned.
OLI.Quantity = 1;
OLI.UnitPrice = PBE.UnitPrice;
insert OLI;

We cannot assign Product2Id to OpportunityLineItem.


Cheers!!!

How to view Chat History in Salesforce?


Cheers!!!

How to get all field names in all objects using Apex in Salesforce?

Sample Code:

        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();    
        Map<String , Schema.SObjectType> globalDescription = Schema.getGlobalDescribe();       
        for(Schema.SObjectType f : gd) {
Schema.sObjectType objType = globalDescription.get(f.getDescribe().getName());
Schema.DescribeSObjectResult r1 = objType.getDescribe(); 
Map<String , Schema.SObjectField> mapFieldList = r1.fields.getMap();  

for(Schema.SObjectField field : mapFieldList.values()) {  
Schema.DescribeFieldResult fieldResult = field.getDescribe();  

if(fieldResult.isAccessible()) {  
System.debug('Field Name is ' + objType + '.' + fieldResult.getName());
}  
}
        }

Cheers!!!

How to update Custom Settings value using Apex in Salesforce?

We can query or we can use getInstance() to get the value and then we can use update keyword to update the Custom Settings value.

Sample Code:

Test__c t = Test__c.getInstance('TT');
t.Size__c = 908;
update t;

Here Test__c is a Custom Settings.

Cheers!!!

Blob.toPDF() not showing Images in Salesforce

1. Check whether the image size is less than 20kb or 15kb.

2. Use system.debug() to print the PDF content before Blob.toPDF() and try to render it as HTML file.

3. Check whether the Image URL is a valid URL.

Cheers!!!

How to access Schema Builder in Salesforce?

1. Create --> Objects --> Schema Builder.


2. Setup --> Schema Builder.


3. Quick Links --> Schema Builder.


Cheers!!!

Quick Links box on the Force.com home page


Cheers!!!

Password Manager in Eclipse

1. Go to Window --> Preferences.


2. Go to General --> Security --> Secure Storage.


Cheers!!!

How to fix System.LimitException: Attempted to schedule too many concurrent batch jobs in this org (limit is 5) issue?

To fix System.LimitException: Attempted to schedule too many concurrent batch jobs in this org (limit is 5) issue, instead of calling Database.execute method in test class, call the Scheduler class in the test method. If the batch class doesn't contain Scheduler class, create a scheduler class for it.

Sample Batch Class:

global class AccountUpdateBatch Implements Database.Batchable <sObject> {
    Set<Id> acctIds = new Set<Id>();
    global AccountUpdateBatch(Set<Id> acctIds) {
        this.acctIds = acctIds;
    }
    
    global Database.queryLocator start(Database.BatchableContext bc) {
        String SOQL = 'SELECT Id, Description FROM Account';
        if(acctIds != null) {
            SOQL += ' WHERE Id IN: acctIds';
        }
        return Database.getQueryLocator(SOQL);
    }

    global void execute(Database.BatchableContext bc, List<Account> listAccount) {
        for(Account acct : listAccount) {
            acct.Description = 'Testing';
        }
        update listAccount;
    }

    global void finish(Database.BatchableContext bc) {
    }
}

Sample Scheduler class:

global class AccountUpdateBatchScheduler Implements Schedulable {
    AccountUpdateBatch objAcctUpdate;
    global AccountUpdateBatchScheduler(AccountUpdateBatch objAcctUpdate) {
        this.objAcctUpdate = objAcctUpdate;
    }
    
    global void execute(SchedulableContext sc) {
        AccountUpdateBatch obj = new AccountUpdateBatch(null);
        if(objAcctUpdate != null) {
            Database.executeBatch(objAcctUpdate);
        } else {
            Database.executeBatch(obj);
        }
    }
}

Test class for the batch class to avoid concurrent issue:

@istest
private with sharing class AccountUpdateBatchTest {
    static testmethod void testSample() {
        Account acct = new Account(Name = 'Test');
        insert acct;
        AccountUpdateBatch obj = new AccountUpdateBatch(new Set<Id> {acct.Id});
        Test.startTest();
        Datetime dt = Datetime.now().addMinutes(1);
        String CRON_EXP = '0 '+ dt.minute() + ' * ' + dt.day() + ' ' + dt.month() + ' ? ' + dt.year();
        String jobId = System.schedule('Sample_Heading', CRON_EXP, new AccountUpdateBatchScheduler(obj) );   
        Test.stopTest();
    }
}

Cheers!!!

How to Set Up Test Data for an Entire Test Class in Salesforce?

To Set Up Test Data for an Entire Test Class in Salesforce, @testSetup is used.

Sample Test Class:

@isTest
private class CommonTestSetup {
/* Method to setup data */
    @testSetup static void setup() {
        /* Create common test Accounts */
        List<Account> testAccts = new List<Account>();
        for(Integer i=0;i<2;i++) {
            testAccts.add(new Account(Name = 'TestAcct'+i));
        }
        insert testAccts;     

/* Create common test Contacts */
        List<Contact> testContacts = new List<Contact>();
        for(Integer i=0;i<2;i++) {
            testContacts.add(new Contact(FirstName = 'TestAcct'+i, LastName = 'TestAcct'+i));
        }
        insert stName = 'TestAcct'+i;
    }

    @isTest static void testMethod1() {
        /* Testing class with Accounts and Contacts */
    }

    @isTest static void testMethod2() {
        /* Testing class with Contacts */

    }
}

@testSetup avoids creation of same set of records to be used in different test methods in the same test class.

Reference:

http://releasenotes.docs.salesforce.com/en-us/spring15/release-notes/rn_apex_test_setup_methods.htm

Cheers!!!

DEV 501 Syllabus

1. Apex

2. Triggers

3. SOQL

4. Order Of Execution

5. Order of Execution in Visualforce page

6. Controller, StandardController and Extensions

7. Coding Standard in Salesforce

8. Debugging Apex code

9. List, Set and Map collection data types

10. Calling Apex method from Custom Button

11. Database.SavePoint and Database.Rollback

12. Unit testing

13. Adding Error message in Visualforce page

14. Visualforce Components

15. Custom Settings

16. Custom Labels

Cheers!!!

How to rename Secure Agent in Informatica Cloud?

1. Go to Configure --> Runtime Environments.


2. Click "Edit Secure Agent...".


3. Do the changes and click "Ok" to save.


Cheers!!!

Permission Convert Leads depends on permission(s): Create Account, Edit Lead

When you face Permission Convert Leads depends on permission(s): Create Account, Edit Lead error while deploying, make sure that you give Create Access to Account and Edit access to Lead.

In case, Account and Lead permissions are not included in the deployment list, update the profile directly in the destination organization to give Create Access to Account and Edit access to Lead.

Without  Create Access to Account and Edit access to Lead, you cannot deploy the profile since the Lead conversion requires  give Create Access to Account and Edit access to Lead.

Cheers!!!

How to log in into Informatica Cloud?

1. Go to www.informaticacloud.com.

2. Click "Informatic Cloud" button under Log In.


3. Enter your username and password and click "Log In". If you don't have an account, click "Don't have an account?" link.



Cheers!!!

How to get Sub String of String using two Strings in Salesforce using Apex?

substringBetween() is used to get Sub String of String using two Strings in Salesforce using Apex.

Sample Code:

String s1 = 'abTestingcd';
String s2 = s1.substringBetween('ab','cd');
system.debug('s2 is ' + s2);//Testing

Output:


Cheers!!!

How to set From Address for sending emails using Apex?

To set From Address for sending emails using Apex, you have to set Or

1. Go to Email Administration --> Organization-Wide Addresses.


2. Click "Add" button.


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


4. Go to the email entered. You would have received an email from Salesforce. Confirm it to verify the email.


5. Go to Developer Console and use the below Query.

SELECT Id, Address, DisplayName FROM OrgWideEmailAddress


6. Store the id in a custom label.

Sample Code:

                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setOrgWideEmailAddressId(system.label.OrgWideEmail); 

Cheers!!!

How To Download and Install the Informatica Secure Agent?

1. Go to Configure --> Runtime Environments.


2. Click "Download Secure Agent...".


3. Select your platform and click "Download".


Cheers!!!

Getting Started with Informatica Cloud

To get started with Informatica Cloud, sign up an account in Inromatica Cloud Academy using the below link

http://cloudacademy.informatica.com/

Note:

In order to sign up or register in Informatica Cloud Academy, personal emails with Email providers like Google, Yahoo, etc.. are not allowed.

Go to Courses link and start watching videos to learn quickly.

Start with Foundational Courses, then Supplemental and then practice all the Learning Labs.

Create a trial organization in Informatica Cloud, using the below link

http://more.informatica.com/en/cloud_trial/org?offer=30day-CAcademy

Cheers!!!

Difference between Dataloader and Import Wizard in Salesforce

Dataloader
Import Wizard
It supports more than 50000 records.
It supports only up to 50000.
It supports almost all standard and custom objects.
It supports Custom objects but only few Standard objects like Accounts, Solutions, Leads and Contacts.
It doesn’t support schedule export.
It supports schedule export.
Delete operation is available.
Delete operation is not available.
It requires installation.
It doesn’t require installation.
While importing, duplicates cannot be ignored.
While importing, duplicates can be ignored.

Cheers!!!

How to find minutes, seconds and Milliseconds difference between two datetime in Salesforce?

getTime() in Salesforce is used to get milliseconds from a Datetime.

Sample Code:

DateTime maxTime = System.now().addMinutes(5);
DateTime minTime = System.now();
system.debug('Milliseconds Difference is ' + (maxTime.getTime() - minTime.getTime()));
system.debug('Seconds Difference is ' + (maxTime.getTime() - minTime.getTime()) / 1000);
system.debug('Minustes Difference is ' + (maxTime.getTime() - minTime.getTime()) / 60000);

Output:



Cheers!!!