Roll Up Summary Fields Winter 16 update

More Roll up Summary Fields per Object

Roll up summary fields winter 16 update: Salesforce has increased the limit of creating roll up summary fields per object.

Before winter 16 release we were able to create only 10 roll up summary fields per object.  But with Winter 16 Salesforce release we can create 25 rollup summary fields per object.

Roll Up Summary Fields

organization isn’t authorized to upload change sets

organization isn’t authorized to upload change sets

Many of you have seen this below error during metadata migration in salesforce by using changsets.

This organization isn’t authorized to upload change sets to other organizations. For authorization, contact the deployment connections administrators on the organizations where you want to upload changes.

This error is because of deployment settings. Seems like you have not created deployment connection between your source org and destination org.

To create deployment connection follow below steps.

login to target environment -> setup -> deploy -> deployment setting -> select source sandbox from the available list of sandboxes – edit -> check allow inbound change sets check box and save.

Now you can upload the change set to the target environment.

Which Salesforce Edition I am using?

How to find which Salesforce edition I am using:

To find which salesforce edition you are using. Follow below steps.

Go to set up ->click on Administer you will edition like below based on which edition you are using.

Salesforce Edition

What are the different Salesforce edition:

Business Plus

There are many other Salesforce editions. there editions base don the which type of service you are using like Sales, Service, marketing and platform.

writing test class for Scheduler and Batches

How to write a test class for Scheduler and Batches:

Here is the example to Write test method for Scheduler and Batch Apex Classes:

Example: This batch Apex is to Approving the opportunities which are in submitted status.

// Scheduler
global class OpportunityScheduler implements Schedulable{
global void execute(SchedulableContext sc){
OpportunityBatch batch = new OpportunityBatch();

// Batch
global class OpportunityBatch implements database.batchable<sObject>{
global String opptyList;
global Database.QueryLocator start(Database.BatchableContext info){
String status = ‘Submitted’;
opptyList = ‘select name,AccountName__c from Opportunity where
status__c =\”+ status +’\” ;
return Database.getQueryLocator(claimList);
global void execute(Database.batchableContext info,List<Opportunity> opptyList){
List<Opportunity> opportunitiesList = new List< Opportunity >();
for(Opportunity oppty: opptyList){
oppty.status__c = ‘Approved’;
Insert opportunitiesList;
global void finish(Database.batchableContext info){


// Scheduler test method
class OpportunitySchedulerTest{
public static testMethod void testschedule() {
OpportunityScheduler testsche = new OpportunityScheduler();
String sch = ‘0 0 23 * * ?’;
system.schedule(‘Test status Check’, sch, testsche );

// Batch test method
public class OpportunityBatchtest{
//query the activities to process
static testmethod void OpportunityTestMethod(){
Opporunity oppty = new Opportunity (); = ‘test Oppty’;
oppty.status__c = ‘submitted’;
insert oppty;
OpportunityBatch opptybatch = new OpportunityBatch ();
Status = ‘Submitted’;
opptybatch.opptyList = ‘select name,AccountName__c from Opportunity where status__c =\”+ status +’\’ and id=\’ AND Id=\”’\”;

How to use system.runAs()|Apex test class Example

How to use system.runAs()?

Here is the example to use System.runAs() in apex test class: For example we have a class to create the campaign only if logged in user is marketing profile otherwise throwing error.

// Apex Trigger
trigger campaignBeforeInser on Account (before insert) {
for(Campaign campaign:{
if(userInfo.getProfileId == ‘marketing profile Id’){
campaign.currency = ‘USD’;
campaign.addError(‘you are not authorized to create campaign’);
//Here is the Test class for above trigger.

private class CampaignTriggersTest{
private static testmethod void campaignTriggersTest(){
Profile prof = [select id from profile where name LIKE ‘%marketing%’];
User user = new User();
user.firstName = ‘test1’;
user.lastName = test2;
user.profileId =,username = ‘’; = ‘’;
insert user;
Campaign campaign = new Campaign(); = ‘laptop’;
insert campaign();

Write test class for trigger?-SimpleExample

How to Write test class for trigger:

Here is the example to write a unit test method for a simple Apex Trigger.
Following trigger is executed whenever account is created and creates sharing to the manager to that record.

Apex Trigger Code:
trigger accountAfterInsert on Account (after insert) {
string managerId= [Select Id, ManagerId FROM User WHERE Id = :userInfo.getUserId()].ManagerId;
for(Account acc: trigger.New){
AccountShare accShare = new AccountShare();
accShare .ParentId = acc.Id;
accShare .UserOrGroupId = managerId;
accShare .AccessLevel = ‘EDIT’;
accShare .RowCause = Schema.accountShare.RowCause.Manual;

// Unit Test for above Trigger
private class AccountTriggersTest{
private static testmethod void accountTriggersTest(){
Account acc = new Account(); = ‘NewAccount’;
acc.address = ‘USA’;
insert acc;

Keywords or functions in Test classes

Keywords or functions in Test classes:

@isTest Annotation:
This annotation is used to define the test class. If we use this annotation then data which we created inside the method doesn’t count against your organization limit. Can be created the method declared as “private” or “public”.

If we use this keyword seeAllData=true , then we get all the data from database. This will be a problem because the data is vary from instance to instance.
seeAllData=false, is not access to the data in the system ,whatever the data need in the test class we have to create in class it slef. Always better to use this method because data will be same for all instances.

This keyword/function is used only in test method, generally Apex code is running in system mode not in user mode and permission and record sharing of the current user are not taken as count.
If we have to call the piece of code which will be execute with specific user then we can use this function.

This keyword/function we can use only in classes not in test classes.
When we have to call the piece of code only from test class then we can use this.
This is Boolean variable return true when calling from test class otherwise false.

What is Unit Test Class in Apex?????

Unit Test Classes in Apex

Testing is the major thing of the development. In salesforce, Apex Code requires the creation and execution of unit tests. Unit tests are class methods that verify whether a particular piece of code is working properly or not. Unit tests are written in Apex Code and annotated with the “testMethod” keyword.

Important thing to note down before to write TestClass:
– At least 75% of code coverage is required to move the apex code to production from sandboxes.
– Whatever we created the data in test class that won’t save in database. (delete all the data once transaction is done)
– Do not write any SOQLs in test class.
– Do not use “seeAllData=true”, Create own data in test class.
– Use As much as Assertions like “System.AssertEquals” or “System.AssertNotEquals”
– To reset the Governor limits for the particular transcation use system.startTest() and system.stopTest()

Writing a simple Unit Test Class:

Apex Class:
public class NewAccountCreation {
public Account account{get;set;}
public void save(){
Account acc = new Account();
// User enter values in vf page and we are capturing and creating account = account.Name;
acc.adress = account.adress;
Insert acc;

// Unit Test class for above apex Class
private class NewAccountCreationTest{
public static testMethod void NewAccountCreationTestMethod(){
NewAccountCreation accountCreation = new NewAccountCreation ();
Account acc = new Account(); = ‘NewAccount’;
acc.address = ‘bangalore’;
insert acc;;

What is Contact? | Salesforce Contact

What is Contact? | Salesforce Contact

What is contact in Salesforce? Contact in Salesforce represents the individual people associated with business account in your organization.

Salesforce CRM provides Contact Management as part of standard functionality, on top of that customers can customize their own functionality. This objects has attributes like FirstName, LastName, AccountId, AssistantName, AssistantPhone¸Birthdate, CanAllowPortalSelfReg, CleanStatus, ConnectionReceivedId, ConnectionSentId, Department, Description, Email, Fax, HomePhone, LeadSource, MailingAddress, MobilePhone, Name, OtherAddress, etc…

To create contact in Salesforce login to your Salesforce account and click on contact tab, click on new button and enter required details & save contact.

Contact Salesforce

What is Accounts in Salesforce|Salesforce Account

Salesforce Account

What is Salesforce Account? Account represents an individual customer account, organization or partner involved with business.

As part of standard functionality provides Account objects in Salesforce which stores all account details related your business like Customers and Competitors.  This object has properties (fields) like AccountNumber, AccountSource, AnnualRevenue, Name, BillingAddress, BillingCity, BillingCountry, BillingCountryCode, BillingLatitude, BillingLongitude, BillingPostalCode, BillingState, BillingStateCode, BillingStreet, Description, Industry, IsCustomerPortal, IsPartner, IsPersonAccount, NumberOfEmployees, Phone, ShippingAddress, ShippingCity, ShippingCountry, ShippingCountryCode, Site etc…

How to create Simple test Salesforce Account? To create Account login to your Salesforce, Click on Account tab and click on new button & enter required fields and Save.

Salesforce Account

What is Person Account? Person accounts are used store information about individual consumers. By default Salesforce accounts are business accounts which stores companies/organization information. Personal account are different  compared to Business accounts in salesforce. Person accounts don’t have contacts. Person account acts contact. It stores first name, last name and other details.

How to enable Person Account? To enable person account Raise a support case with

What is the relationship between account & Contact? Actual relationship between account & contact is Master detail relationship. But from the UI it shows look up relationship look & feel. If you delete account, its associated  contacts will be deleted. It shows it is master detail relationship.