Friday, May 30, 2014

What is TestVisible annotation in Salesforce?

What is TestVisible annotation in Salesforce?


Hi,
This is the documentation notes about @TestVisible annotation in salesforce. 

Use the TestVisible annotation to allow test methods to access private or protected members of another class outside the test class. These members include methods, member variables, and inner classes. This annotation enables a more permissive access level for running tests only. This annotation doesn’t change the visibility of members if accessed by non-test classes.

With this annotation, you don’t have to change the access modifiers of your methods and member variables to public if you want to access them in a test method. For example, if a private member variable isn’t supposed to be exposed to external classes but it should be accessible by a test method, you can add the TestVisible annotation to the variable definition.

This example shows how to annotate a private class member variable and private method with TestVisible.


public class TestVisibleExample {
    // Private member variable
    @TestVisible private static Integer recordNumber = 1;

    // Private method
    @TestVisible private static void updateRecord(String name) {
        // Do something
    }
}    

This is the test class that uses the previous class. It contains the test method that accesses the annotated member variable and method.

@isTest
private class TestVisibleExampleTest {
    @isTest static void test1() {
        // Access private variable annotated with TestVisible
        Integer i = TestVisibleExample.recordNumber;
        System.assertEquals(1, i);

        // Access private method annotated with TestVisible
        TestVisibleExample.updateRecord('RecordName');
        // Perform some verification
    }





That's It!

Enjoy the Coding !!!!!!   

Thursday, May 29, 2014

How to configure Sharing Rules in Salesforce?

How to configure Sharing Rules in Salesforce?


Continuing on setting up security with for our example sales organization, let’s say that you have support staff in the role of Sales Engineer that report directly to the VP, North America Sales. Sales Engineers lend technical assistance on Opportunities, and thus need to see Accounts and Opportunities owned by the salespeople under the VP, North America Sales. To do this, you would have a Sharing Rule as follows:









How to Configure Groups in Salesforce?

How to Configure Groups in Salesforce?


Let’s say that the Director, Direct Sales does want to allow her team to have access not only to her records but also access to records owned by the Eastern Sales Team and theWestern Sales Team. First you would create a Public Group from Setup >Administration Setup > Manage Users > Public Groups and click the “New” button.




We create a group name called “Direct Sales Team,” we searched by Roles to include theDirector, Direct Sales, the Western Sales Team and the Eastern Sales Team, and clicked the “Save” button. Now that we have our group we can create a Sharing rule to grant access.  Let’s say that we want to grant access to Leads for this new Group. We would go to Setup > Administration Setup > Security Controls > Sharing Settings. Under the related list of “Lead Sharing Rules” we’d click “New” and from the new window we’d set the rule as follows:


We’ve basically said anyone in that group gets to access records owned by anyone else in the group.
Now our security diagram looks a little different than before. We tore down the blue dotted line that separated the Eastern Sales Team and the Western Sales Team and the new opaque red bubble illustrates the new sharing rule created above – it’s an exception to our overarching OWD security!












What is Organization-Wide Defaults(OWD) in salesforce?

What is Organization-Wide Defaults(OWD) in salesforce?


Organization-Wide Defaults, or OWDs, are the baseline security you for your Salesforce instance. Organizational Wide Defaults are used to restrict access. You grant access through other means we will talk about later (sharing rules, Role Hierarchy, Sales Teams and Account teams, manual sharing, etc).

There are four levels of access that can be set:
  • Public Read/Write/Transfer (only available of Leads and Cases)
  • Public Read/Write
  • Public Read/Only
  •  Private 
To reduce the number of variables in this discussion let’s collapse the three “Public” flavors to a single bucket and frame the discussion around the impact of changing your OWDs from “Public” to “Private.” As we mentioned before, Organization-Wide Defualts are used restrict access, not grant access. If you need to restrict access to even one individual out of a 1,000 Users, the only way to do that is to set your Organizational Wide Defaults to “Private,” and grant access back to everyone else but that single User you need to keep in the dark.
Shields up!
What does setting your OWDs to “Private” really do? The best way to explain this concept is with an org chart. A traditional Org Chart would look cleaner, but let’s look use the Role Hierarchy diagram shown in “Tree View” since it’s available inside Salesforce.com.

When you flip an Object in your OWDs to “Private” you’ve in essence erected walls between users in the same level of the Role Hierarchy. To illustrate using my diagram below, the restricted access walls set by the flipping an Object to “Private” are represented by the dashed green, red and blue lines. For the Object set to “Private,” the Users in the Role ofEastern Sales Team can no longer see records owned by the Western Sales Teambecause they are at the same level of the Role Hierarchy (looking “across” the same level is represented by the solid blue, red and green double headed arrows in the diagram below). The same is true the next level up in the Role Hierarchy. The Users in the role Director, Direct Sales cannot see records owned by the Director, Channel Sales.  Not surprising, access continues to be limited up the ladder across the same tiers of the Role Hierarchy. OurVP, North America Sales, the VP, Marketing and the VP, International Sales cannot see records owned by their peers, nor can they see the records owned by their peer’s subordinates. If you can’t look across, then you can’t look across and then down – e.g. theDirector, Direct Sales cannot see the records owned by the Channel Sales Team(because they are a subordinate to the Director, Direct Sales peer, the Director, Channel Sales).


Here is where the Role Hierarchy grants access in a Private setting. Manager’s (meaning, Users that have a higher position in the Role Hierarchy) can always see the records owned by their role subordinates. Using our diagram again, access granted by the Role Hierarchy is represented by the curved pink, yellow and blue lines. The SVP, Sales & Marketing can see the records owned by his role subordinates – the VP, North America SalesVP, Marketingand the VP, International Sales. Not surprising the VP, North American Sales can see records owned by the Director, Channel SalesDirector, Direct Sales and down the Role Hierarchy to their direct reports – the Channel Sales Team, the Western Sales Team and the Eastern Sales Team.

On an Object with its OWDs set to “Private,” the Role Hierarchy grants access down to subordinate roles’ records, but does not grant access upward. For example, The Western Sales Team cannot see records owned by their manager the Director, Direct Sales(because it is one level up the Role Hierarchy).

The impact to Reports, Views, Search and Lookups
NOTE: If a User cannot see a record due to security settings, that restriction cascades throughout Salesforce.com. Meaning, that User will not see the record using Search, Views on Tabs, Reports, and Lookups.

What is the difference between a Profile and Role?

What is the difference between a Profile and Role?


Roles are one of the ways you can control access to records. They also impact reports (e.g. "My Teams" filter). Roles come into play if your security model (OWDs) are set to private. A little more on Roles and how they impact security:

Profiles help determine record privileges. Assuming the User can see the record, Profiles determine what the User can do, view or edit on that record. Profiles control other system privileges as well (mass email, export data, etc).




What all the services provided in cloud computing?

What all the services provided in cloud computing?


Hi!

In this post i am trying to explain about what is cloud computing and what are the different services offered by cloud computing.


Cloud Computing Services provide information technology (IT) as a service over the Internet or dedicated network, with delivery on demand, and payment based on usage. Cloud computing services range from full applications and development platforms, to servers, storage, and virtual desktops.

Who uses cloud computing services and why?
Corporate and government entities utilize cloud computing services to address a variety of application and infrastructure needs such as CRM, database, compute, and data storage. Unlike a traditional IT environment, where software and hardware are funded up front by department and implemented over a period of months, cloud computing services deliver IT resources in minutes to hours and align costs to actual usage. As a result, organizations have greater agility and can manage expenses more efficiently. Similarly, consumers utilize cloud computing services to simplify application utilization, store, share, and protect content, and enable access from any web-connected device.

How cloud computing services work
Cloud computing services have several common attributes:

Virtualization- cloud computing utilizes server and storage virtualization extensively to allocate/reallocate resources rapidly

Multi-tenancy -resources are pooled and shared among multiple users to gain economies of scale

Network-access - resources are accessed via web-browser or thin client using a variety of networked 
devices (computer, tablet, smartphone)

On demand - resources are self-provisioned from an online catalogue of pre-defined configurations

Elastic -resources can scale up or down, automatically

Metering/chargeback -resource usage is tracked and billed based on service arrangement

Among the many types of cloud computing services delivered internally or by third party service providers, the most common are:

Software as a Service (SaaS) – software runs on computers owned and managed by the SaaS provider, versus installed and managed on user computers. The software is accessed over the public Internet and generally offered on a monthly or yearly subscription.

Infrastructure as a Service (IaaS) – compute, storage, networking, and other elements (security, tools) are provided by the IaaS provider via public Internet, VPN, or dedicated network connection. Users own and manage operating systems, applications, and information running on the infrastructure and pay by usage.

Platform as a Service (PaaS) – All software and hardware required to build and operate cloud-based applications are provided by the PaaS provider via public Internet, VPN, or dedicated network connection. Users pay by use of the platform and control how applications are utilized throughout their lifecycle.

Benefits of cloud computing services
Cloud computing services offer numerous benefits to include:
  • Faster implementation and time to value
  • Anywhere access to applications and content
  • Rapid scalability to meet demand
  • Higher utilization of infrastructure investments
  • Lower infrastructure, energy, and facility costs
  • Greater IT staff productivity and across organization
  • Enhanced security and protection of information assets











Simple Pagination using apex in Salesforce?

Simple Pagination using apex in Salesforce?


Hi !,

Here i am going to give an example of simple pagination on Account object. to achieve this we need to create Visualforce page and Controller Class.

Visualforce Page:-

<apex:page controller="AccountPaginationController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Account Results -  Page #{!pageNumber}" columns="1">
                <apex:pageBlockTable value="{!listAccount}" var="a">
                    <apex:column value="{!a.Name}"/>
                    <apex:column value="{!a.AccountNumber}"/>
                    <apex:column value="{!a.Type}"/>
                </apex:pageBlockTable>
                <apex:panelGrid columns="4">
                    <apex:commandLink action="{!first}">First </apex:commandlink> 
                    <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous |</apex:commandlink>
                    <apex:commandLink action="{!next}" rendered="{!hasNext}">Next |</apex:commandlink>
                    <apex:commandLink action="{!last}">Last</apex:commandlink>
                </apex:panelGrid>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Controller Class:-

public class AccountPaginationController {
 public ApexPages.StandardSetController con {
        get {
                if(con == null) {
                    con = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id, Name, AccountNumber,Type FROM Account Order By Name limit 100])); 
                    //here you can set the record size to display                
                    con.setPageSize(3);       
                }
                return con;
        }
        set;
    }
    
    public List<Account> getlistAccount(){
        return (List<Account>)con.getRecords();
    }
    
    public Boolean hasNext {
        get {
                return con.getHasNext();
            }
        set;
    }
   
    public Boolean hasPrevious {
        get {
            return con.getHasPrevious();
        }
        set;
    }
   
    public Integer pageNumber {
        get {
            return con.getPageNumber();
        }
        set;
    }
   
    public void first() {
        con.first();
    }
   
    public void last() {
        con.last();
    }

    public void previous() {
        con.previous();
    }
    
    public void next() {
        con.next();
    }
  
    public void cancel() {
        con.cancel();
    }        


}

then here is the final out put of this page



That's it.
Enjoy the Coding !!!!!!

What is the Architecture of Salesforce Software?

What is the Architecture of Salesforce Software?


Hi !
In this post i am trying to give some details about salesforce architecture.


Salesforce uses a cloud-based "multi-tenant" architecture."Cloud Based" meaning that you do not install software locally on a server. Salesforce software is accessed over the Internet (the cloud) on Salesforce servers. The Salesforce database is actually Oracle on the back end by the way The analogy salesforce uses frequently to describe "multi-tenancy" is an office building. Like an office building, Salesforce users have secure barriers (likes walls in an office) that divide your business from someone else's business (and your data!). However that office building that you share provides all the structure (stairs, elevators) and utilities (power, water, etc). In a multi-tenant architecture you don't have a single installation for your Salesforce instance - you're really a sub-set of a much larger database. Salesforce keeps your configuration unique by storing meta-data about all your customizations even though you're running on a shared database. You share Salesforce.com's services (think the "utilities analogy aforementioned) such as the security model, the ability to access Salesforce on mobile devices, API services, etc..





Wednesday, May 28, 2014

How to disable Force.com Quick Access Menu in Salesforce?

How to disable Force.com Quick Access Menu in Salesforce?


Hi !,

In this post i am going to tell about how to disable quick access menu from salesforce, In previous post we discuss about how to enable quick access menu in salesforce.

To disable quick access menu from salefrorce  Select any tab like Account,Contact,Opportunity etc and click on Quick access menu, then it will appear in Right Side, then click on Turn Off Menu.




That't it 
Enjoy !!!!!!!!


How to enable Quick Access Menu in Salesforce?

Hi,

Here i am going to explain how to get Quick Access Menu in Salesforce.

1. Go to My Settings.



2. Select Personal and Advanced User Details.



3. Click "Edit".

4. Enable "Force.com Quick Access Menu".
      
       







That's it !!!
Enjoy 

Monday, May 26, 2014

How to Create Visualforce Related List with Edit and Delete Action's?

How to Create Visualforce Related List with Edit and Delete Action's?


I have requirement of create a Visualforce Related List to display opportunity Details in Contact object with Edit and Delete Actions.

Page:- 

<apex:page standardController="Contact" extensions="sampleDetailPagecon">
<style>
.fewerMore { display: none;}
</style>
 <apex:form >
 <apex:pageMessages />
 <apex:detail relatedList="true"></apex:detail>

 <apex:pageblock id="CustomList" title="Related Opportunities">
 <apex:pageblocktable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}">
  <apex:column >
             <apex:facet name="header">Action</apex:facet>
                        
  <apex:commandLink action="{!editOpp}" value="Edit">
  <apex:param name="oppid" value="{!o.id}"/>
 </apex:commandLink> &nbsp; | &nbsp;   <apex:commandLink action="{!deleteOpp}" value="Delete">
  <apex:param name="oppid" value="{!o.id}"/>
 </apex:commandLink>
 </apex:column>
 <!-- 
 <apex:column >
   <apex:commandLink action="{!deleteOpp}" value="Delete">
  <apex:param name="oppid" value="{!o.id}"/>
 </apex:commandLink>
 </apex:column>
 -->
 <apex:column value="{!o.Name}"/>
 <apex:column value="{!o.Account.Name}"/>
 <apex:column value="{!o.Type}"/>
    <apex:column value="{!o.CloseDate}"/>    
 </apex:pageblocktable>
 </apex:pageblock>
 </apex:form>
  <apex:relatedList list="Opportunities" />
</apex:page> 

Controller Class :-


public class sampleDetailPagecon {
private List<Opportunity> oppz;
private Contact cntact;
public sampleDetailPageCon(ApexPages.StandardController controller) {
 this.cntact=(Contact)controller.getRecord();
 }
 public List<Opportunity> getOppz()
 {
     Contact con = [Select id, Account.id FROM Contact where id =:cntact.id];
     if(con.Account==null)
     return null;
     oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id =: con.Account.Id];
     return oppz;
 }
 public Pagereference editOpp()
 {
     String oppid= ApexPages.currentPage().getParameters().get('oppid'); 
     
    return new PageReference('/006/e?id='+oppid+'&retURL=/006/');
 }
  public Pagereference deleteOpp()
 {
     String oppid= ApexPages.currentPage().getParameters().get('oppid'); 
     
     Opportunity opp = [Select id from Opportunity where id =:oppid limit 1];
     if(opp !=null && opp.id !=null){
      delete opp;
     }
    return null;
 }
}


once this is done you need to add the Visualforce section in Contact object with Edit page layout and add this visualforce section in contact related list.

Thats it !!!!!!

Friday, May 2, 2014

Salesforce Q&A 2

Salesforce Q&A 2? Salesforce Interview Questoins part-2


1. For which criteria in workflow “time dependent workflow action” cannot be created?
Ans: created, and every time it’s edited
2. What is the advantage of using custom settings?
Ans : You dont have to query in apex (fire select query) to retrieve the data stored in custom settings.

3. What are the different workflow actions available in workflows?
Ans: 1. Field update 2. Email alert 3. send Outbound messages 4. Create new task

4. What is whoid and whatid in activities?
Ans: Whoid is the id of either contact or Lead. Whatid is the id of the related to record in activity record(standard or custom object)

5. What is the difference between a standard controller and custom controller
Ans: standard controller inherits all the standard object properties, standard button functionalities can be directly used. Custom controller defines custom functionalities, a standard controller can be extended to develop custom functionalities using keyword “extenssions”

6. Can you have more than one extenssions associated with a single page?
Ans : Yes we can have more than extenssions.

7. If page is having multiple extenssions and if two extenssions have methods of same name.     Then which method out of these two will be called upon calling from vf page ?

Ans: The one which is present in the controller defined on the left side will be called.

8. What are governer limits ?
Ans: Governer limits are the limits imposed by salesforce so as to avoid monopoly by orgs in using salesforce shared resources.

9. how can we implement pagination in visualforce ?

Ans: use standardset controllers for implementing pagination.

10. What is the difference between force.com and salesforce.com
Ans: force.com is paas(platform as a service) and salesforce.com is Saas(software as a service)

11. What is a externalid in salesforce
Ans: It is a field which can be used to store a value that is used as a refernce for that record in other system. For example if you have a record in system ‘xyz’ where it is referenced by some value then that value can be used as external id in salesforce for that record. External id can be used for upsert operation in data loader

12. What happens upon lead conversion ?
Ans: When lead is converted a contact, account and optionally an opportunity is created.

13. What are different ways of deployment in salesforce ?
Ans: Change sets, eclipse and ANT

14. How can you override a list button with a visuaflorce page?
Ans: Visualforce page should be a list controller that is it should have “recordsetVar” attribute defined in page tag.

15. Is it possible to bypass Grant Access Using Hierarchies in case of standard objects ?
Ans : No. This is default and cannot be changed.

16. How can you call a controller method from java script ?
Ans: Use action function component to call controller method from java script.

17. How can you call a visualforce page from a controller method?
Ans: Use pagereference object for calling a visualforce page from controller method

18. How can you sort a select SOQl query ?
Ans: use order by clause in select query for sorting a list of records

19. How much code coverage is needed for deployment?
Ans : Each trigger should have minimum of 1%. Class can have 0%. But, the total code covergae of 75%.

20. Can ‘set’ store duplicate values in it?
Ans : No. Set only stores unique values. List can have duplicate values in it.

21. Can two users have same profiles?
Ans: Yes
22. How can you refresh a particular section of a  visualforce page?
Ans: This can be done using reRender attribute

23. How can you create a many to many relationship in salesforce?
Ans: This can be done by creating junction object between the two objects.

24. What happens to detail record when a master record is deleted?
Ans: detail record gets deleted.

25. What happens to child record when a parent record is deleted?
Ans. Child record remains undeleted

26. How to get current logged in users id in apex ?
Ans: Use Userinfo.getuserid() to get the current logged in user’s id in apex.

27. How to convert a csv file  browsed in visualforce page into a string.
Ans: use csvfilecontents.tostring(). method to convert blob to string

28.How many records can a select query return ?
Ans : As of now it can return upto 50000 records.

29. How many records can a sosl query return ?
Ans: as of now it can return upto 2000 records

30. How to fire dynamic query in soql?
Ans: Using database.query
Example: List<account> accList = Database.query(‘select name from account’);

31. What is a bucket field in reports?
Ans: This field is used for custom grouping of values in a field. This can be used in summarising the report.

32. What are dynamic dashboards ?
Ans: Dashboards which run for logged in user are dynamic dashboards

33. Can the dynamic dashboards be scheduled?
Ans: No they cannot be scheduled.
34.How can you use custom label; in visualforc page?
Ans: Use this syntex for accessing custom albel in visualforce page – {!$Label.Samplelabel}

35.What are the types of custom settings in salesforce?
Ans: List type and Heirarchy type

36.What are the different types of collections in apex?
Ans: There are three types of collections in apex language
1. Set
2. List
3. Map

37. What are maps in apex?
Ans: Map has keys and values. A key points to a single value. Map can be used to store realationship between two entities. Keys in map are unique. Values can be duplicated.

38. What are the different types of object relations in salesforce ?
Ans: 1. One to many
2. Many to many
3. Master detail

39.Can you have roll up summary fields in case of parent child relationship?
Ans: No. These are present only in case of master details relationship.

40. Can you see a lead which is converted in saleforce UI?
Ans: The detail record is not seen. But a page, wherein it shows the links for formed account, contact and opportunity.

41. What is the difference between action function and action support ?
Ans: Action functions can call controller method from java script, action support adds support to other components.

42. What is action poller in visualforce ?
Ans: Action poller sends AJAX request with a specified time interval.

43. What are the different types of reports available in salesforce?
Ans: 1. tabular report
2. Summary Report
3. Matrix Report
4. Joined Report

44. How many active assignments rule can you have in lead/Case?
Ans: You can have only one active assignment rule at a time

45. How do we access static resource in visualforce?
Ans: Use this syntex for accessing static resource {!$Resource.Testresourcename}

46. How to embed a visaulflow in a visualforce page ?
Ans: Use this syntex to embed flow in vf page : <flow:interview />

47. How to enable inline editing in visauflorce page ?
Ans You can enable inline editing in visualforce page by using <apex:inlineEditSupport> component.

48. What is trigger.new in trigger ?
Ans: trigger.new is a list of records that are in the context of trigger or because of these records(modification, Creation, deletion) the trigger has been called

49. How do we bulkify the trigger ?
Ans: Bulkfification requires iterating over all the records in trigger context
for example : for(account ac: trigger.new){
// your logic here
}

50.How can we get the old value in trigger ?
Ans: use trigger.old map for getting previous values of fields.

51. Can we modify records directly in trigger.new ?
Ans: trigger.new is a read only list, but field values can be changed in case of before trigger

52. What does the error “list has no rows for assignment” mean?
Ans: it means the list you are trying to access has no values in it.

53. Why should we not write select query within for loop?
Ans: Writing select query within for loop may hit the governer limit of 100 select queries.

54. What should we do to avoid view state error in visualforce page?
Ans: Clear unused collections, define variable as transient.

55. What is a sandbox org?
Ans: It is the exact copy of your production org. This could be full copy, developer or configuration only type.

56. What is sosl?
Ans: select query that can return records of multiple objects as list of lists

57. How many records a select query soql can return?
Ans: as of now the limit is 50000

58. What is the full form of AJAX?
Ans: it stands for assynchronous java and XML

59. Why do we need to write test classes?
Ans: Salesforce does not allow deployment in production if the test coverage is less than 75%

60.How can you show a custom error message in trigger?
Ans: This can be done using addError() method in trigger

61. What is the use of future annotation?
Ans: Future method starts execution when Salesforce has resources available. That is for asynchronous execution.
62. How to identify if a class is a test class?
Ans: test class always begins with @isTest

63. How to convert a blob variable into a string?
Ans Use toString to convert blob into string

64. what are the different methods of batch apex class?
Ans: start method, execute method and finish method

65.What is’ with sharing’ in apex class code?
Ans: When you use ‘with sharing’, user’s permissions and field-level security are respected. In case of ‘without sharing’ code runs in system mode.
66. How many records can a sosl return ?
Ans: It can return 2000 records as of now as per governors limit
Ans: To use dml in visualforce component you have to declare allowdml=true in visualforce component otherwise you will get an exception
“DML is currently not allowed”

68. Can you write sosl in trigger>?
Ans: NO sosl are not allowed in triggers, they can only be used in classes.

69. Which are the different access modifiers in apex?
Ans: 1. Private 2. Public 3. Protected 4.Global are the four access modifiers allowed in apex

70. Can you change the master of a detail record in salesforce ?
Ans. Yes provided you have ticked marked “Allow reparenting” in field setting otherwise the field is read only and master cannot be changed.

71. How can you lock records in apex?
Ans: use For update in query to lock the record. For example: [select id,name from contact limit 10 For update];

72. IS there any limit on the number of items that can be stored in apex collections?
Ans: There is no such limit but we need to consider heap size limit 6mb (6 MB as of now)

73. How can you monitor future actions of time based workflow?
Ans: setup –> administration set up –> monitoring –> time based workflow

74. What is visaulforce component ?
Ans: It is a piece of code that can be reused. It can be encapsulated in other visualforce pages.

75. Ho can you display the status of an AJAX update request in a visualforce page ?
Ans: To display AJAX request status we can use <apex:actionstatus> component.

76. How can you access custom label in apex:?
Ans: Example –> string custLabelstr = System.Label.LabelNamehere

77.How can you get all the keys of a map variable ?
Ans: USe method keyset() for this
Example = Set<id> idSet = mapname.keyset();
78. How can you compare values of a picklist field in validation rule?
Ans : for comparing picklist value use ispickval
ISPICKVAL(picklist_field, text_to_compare)

79. What are the different types of sandboxes in salesforce ?
Ans: Developer, Full copy and configuration only are the three types of sandboxes in salesforce.
80. With what frequency can you refresh a full copy sandbox?
Ans: full copy sandbox can be refreshed every 28 days from production.

81. How can you make fields required on a visualforce page?
Ans: mark required = true as done in the example below:
<apex:inputfield value=”{!account.Description}” required=”true”/>

82. What is minimum coverage for every trigger for deployment?
Ans: every trigger should have a minimum coverage of 1%. Total coverage should be 75%

83. What is minimum coverage for every class for deployment?
Ans: There is no such requirement. A class can have 0% but the total coverage should be >75%

84. How can you implement custom functionality for a standardcontroller visualforce page?
Ans: This can be done by associating a controller class with that standard controller using “Extenssions”

85. How can you get the current record id in a visualforce page ?
Ans use ApexPages.CurrentPage().getparameters().get(‘id’) to get the current record id in visaulforce page.

86. Can a user change his own profile in salesforce ?
Ans: No, a user cannot change his own profile !!

87. Can a user change his own role?
Ans: Yes this can be done !!

88. Reset security token option is unavailable in set up. What could be the reason?
Ans: If in the profile setting “login ip ranges” have been set up then the option of “reset security token” is unavailable.

89. How can you skip record type selection page(and take up default record type) while creating new record of a particular object ?
Ans: just tick mark against the object by navigating to following :
set up –> my personal information — > Record type selection –> check against the required object

90. What are the different data types that a standard field record name can have?
Ans: Record name field can have either of the two data types : Auto Number or Text data type

91. Can you edit a apex trigger/apex class in production environment ?
Ans: No apex trigger /class cannot be edited in production.

92. Can you edit a visuaflorce apge in production environment ?
Ans: Yes this can be done.

93.How can you deliver a visualforce page in excel form ?
Ans: use contentType=”application/vnd.ms-excel#Contacts.xls” in page component of visualforce page

94. What is trigger.new?
Ans: It is a list of records in current context in a trigger.

95. What does it mean when you get the error “too many soql queries 101 salesforce”?
Ans: It means you are hitting the limit of 100 soql queries as per governors limit

96. How can you create a input field for date on a visualforce page ?
Ans: To create a input date field on vf page you will have to bind it with a existing date field on any object.

97. How can you convert a text to upper string ?
Ans: stringname.toUppercase();

98. How can you convert a integer into a string ?
Ans: string.valueof(integerName);

99. What are the different types of email templates that can be created in salesforce?
Ans: Test, HTML (using Letterhead), Custom (without using Letterhead) and Visualforce.

100. How can you display different picklist values for picklist fields in different page layouts?
Ans: This can be done using record types.

101. Can you do a dml in constructor?
Ans: No this cannot be done.

102. What are the data types that can be returned by a formula field?
Ans: 1.Checkbox 2. currency 3.Date 4.Date/Time 5.Number 6.Percent 7.Text

103. Can you create a new profile from scratch ?
Ans: No, you have to clone from a existing profile and modify the settings as required.

104. What are custom labels in saleforce?
Ans custom labels are custom text values that can be accessed from apex codes and visualforce pages.

105. What is the character limit of custom label ?
Ans: Custom labels can be only 1000 characters long, not more than that.

106. How long can a sandbox name be?
Ans: It can only be of upto 10 characters not more than that.

107. Can you use sharing rules to restrict data access?
Ans No, sharing rule can only give wider access to data it cannot restrict data access.

108. Can you edit a formula field values in a record?
And: formula fields are read only and cannot be edited.

109. Can you edit roll up summary field values in a record?
Ans: No, roll up summary fields are read only and cannot be edited.

110. Ho can you create relationship between two objects in salesforce?
Ans relationship can be set up by crating either look up relationship field or master detail relationship fields on objects.

111. Can you create a roll up summary field on parent object?
Ans: Roll up summary fields can only be created if the relationship between objects is master detail type.


 
| ,