October 24, 2014

Mobile Verification Code Setting for Salesforce.com Login Users

Description:

In Salesforce when we login it will be sending 6 digit Pass-code directly to your mobile or email Inbox. After Winter’14 release you can able to setup Time-Based Tokens for Identity Confirmation for any user’s in your organization.

Procedure to get mobile verification code when we login:

Step 1 : Goto  Setup->Security Controls->Session Settings

Check the Enable SMS based identity confirmation.



Step 2 : Goto Setup->Manage Users->Users

Enter the mobile number in the users profile if it is not entered and save it.



 Step 3 : After the changes have been done logout the org and login again.When you try to login now it will ask mobile verification as below.


October 23, 2014

How to uploading a file as an attachment using Visual force Page and Custom Controller

Steps to Upload a File:

Step 1 : Creating a Custom object Employee.



Step 2 : Create the custom fields which required in Employee Object.



Step 3 : Create Visual force Page on Employee Object

https://c.ap1.visual.force.com/apex/UploadFileEx

Visual force Page Name: UploadFileEx



Step 4 : Write Controller for VF Page

Controller Name : UploadFileController



Step 5 : Output



Step 6 : Enter the  Details in fields



Step 7 : Records saved in Employee Object






Step 8 : Test Class for the Apex Class(UploadFileController)




Step 9 : Run the Test Class and check code coverage.

Org Name->Developer Console->Test->New Run-->Success

Code Coverage:100%



Interview Questions:

  • What is the difference between <apex:inputtext> and <apex:inputfield> ?
  • Which tag is used to upload a file in Visual force page?
  • Which annotation is used to write test class?
  • What is the syntax to write test class?
  • What is the total code coverage should be there to deploy code from Sandbox to Production?
  • What is the minimum code coverage should be there for Test Class and Trigger to do Deployment?
  • What are the attributes present in <apex:inputtext>and <apex:inputfield>?
  • What is <apex:outputpanel> and what are its attributes ?
  • What is Constructor?

October 21, 2014

Field Sets in Salesforce

Description:
  • A field set is a grouping of fields. Field sets can be referenced onVisualforce pages dynamically.
  •  If the page is added to a managed package, administrators can add, remove, or reorder fields in a field set to modify the fields presented on the Visualforce page without modifying any code.
  • We can use dynamic bindings to display field sets on our Visualforce pages.
  • Fieldset is very useful when we are working with managed package.
  • Field sets are available for visualforce pages on API version of 21.0 or above. You can have up to 50 field sets referenced on a single page.

Example:

Step 1: Create Field set in Opportunity Object.

Setup->Customize->Opportunity->Field Sets



Step 2: Drag and Drop the fields required for the Field Set


Step 3:Create records in opportunity Object


Step 4: Create Visual Force Page

https://c.ap1.visual.force.com/apex/FieldSetExample

Visual Force Name: FieldSetExample


Step 5: Write the Controller for the VisualForce Page

Apex Class: OpportunityFieldSetController


Step 6: Output


Interview Questions:
  • Explain Field Sets in Salesforce?
  • Can Field Sets used in both Standard and Custom objects? 

October 20, 2014

Custom Settings in Salesforce


Description:

Custom settings to create and manage custom data at the organization, profile, and user levels. Custom settings data is stored in the application cache. It can access efficiently, without the cost of repeated queries. Custom settings data can be used by formula fields, Visualforce, Apex, and the Force.com Web Services API.

There are two types of custom settings:

List Custom Settings:

It have user-independent values, retrieved under multiple names.
  •          Setting for development environment.
  •          Setting for volume testing environment.
  •          Setting for production environment.
List custom settings need to be accessed using a controller if you want to availiable them on a page, for example return ListSetting__c.getInstance('Test1').Field__c;

Note: It can be stores static data that can be used in apex code.

Hierarchy Custom Settings:

It can be configured at varying user specificity levels under a single name;
  •          Setting per user.
  •          Setting per profile.
  •          Setting for whole org.
Hierarchy custom settings are easily retrieved in Visualforce: {!$Setup.Student__c.Field__c} and will be resolved according to the current user context.

Note: It Can be stores data that may change depending on user, profile or org wide default.

How to configure Custom Setting in salesforce:

Step1:Goto---->Setup---->Custom Setting--->Click on New Button---->To Create Custom Fields

    
                      



Step 2: Click New Button enter All Information

     
                       



Step 3:Click Manage Button to see all records particular object(StudentData__c) in custom setting.

                       


Example:

https://c.ap1.visual.force.com/apex/CustomSettingEx

Visualforce page name: CustomSettingEx

     
                   


Apex Class: CustomSettingMethod


                     



Output:

                      


Note:
Custom settings have their own instance methods to allow easy access.
It looks like

                        


Limits in Custom Settings:

1. The total amount of cached data allowed for your organization :
    i.  1 MB multiplied by the number of full-featured user licenses in your organization.
    ii. 10MB.
2. 300 fields per custom setting.
3. You can’t share a custom setting object or record.
4. Custom settings are a type of custom object.
5.Each custom setting counts against the total number of custom objects available for your organization.

Interview Question's on this topic:
  • What is Custom settings?
  • How Many Types of Custom Settings?
  • What are instance methods in custom settings?