Sunday, September 23, 2012

Dev 401 Certification Mock Exam 4

1) Apex is a Object based language ?
A. True
B. False

2) Which type of application can be created using the Flex Framework for Choose 3 answers
A. Browser-based Flash applications
B. Apex applications
C. Disconnected desktop applications
D. Connected desktop applications
E. VMforce applications

3) The showChatter attribute is available on which Visualforce component?
A. apex:chatter
B. apex:pageBlock
C. apex:detail
D. apex:page

4) A sales manager would like to view a dashboard from the perspective of different users and switch between users without editing the dashboard. How would an administrator enable this?
   Choose 2 answers
A. Create the dashboard as a dynamic dashboard.
B. Grant the sales manager the "Manage Dynamic Dashboards" permission.
C. Grant the sales manager the "Drag-and-Drop Dashboard Builder" permission.
D. Grant the sales manager the "View My Team's Dashboards" permission.

5) What can users do when Chatter feed tracking is enabled for dashboards?
   Choose 2 answers
A. Follow files and links for a dashboard.
B. Auto-follow dashboards created by the user.
C. Follow posts and comments for the dashboard source reports.
D. Follow posts and comments for a dashboard.

6) Which combination of objects is available when creating a custom report type for Chatter reports?
  Choose 2 answers
A. Chatter Groups, Members
B. Opportunities, Followers, User Feed
C. Accounts, User Feed, Comments
D. Users, User Feed, Comments

7) Which is a capability of the improved System Log console?
  Choose 3 answers
A. View feedback on usage against governor limits
B. Run as a specific user
C. Execute anonymous blocks
D. Generate a dialog box when a usage limit is reached
E. View a stack trace

8) Which is a capability of Visualforce components for Chatter?
  Choose 2 answers
A. Include a Chatter feed on a record detail.
B. Include Chatter followers on a record detail.
C. Include Chatter recommended people to follow on a record detail.
D. Include a list of Chatter-enabled fields on a record detail.

9) Which technology is used to create applications with the Adobe FlashBuilder for
  Choose 3 answers
A. Java
C. Flex
D. Web Services API
E. Apex

10) Which function is available in the report builder interface, prior to running the report?
  Choose 2 answers
A. Printable view
B. Schedule future runs
C. Save
D. Export details
E. Show/hide details

11) Which is a consideration when creating a drill-to-detail dashboard component?
A. Drill-to-detail must be enabled on the custom report type.
B. The dashboard component type must be a gauge.
C. The source report must be grouped by record name, record owner, or feed post.
D. The source report must be stored in the drill-to-detail folder.

1) A
2) A,C,D
3) C
4) A,D
5) A,D
6) A,D
7) A,C,E
8) A,B
9) B,C,D
10) C,E
11) C

Monday, September 17, 2012

How to call PageReference Method on page load

Using "action" attribute of Apex:page tag, we can call a page reference method that will return the new page reference or redirect to the new page.

<apex:page controller="TestController" action="{!checkAndRedirect}"...></apex:page>
Public Class TestController{  
    public PageReference checkAndRedirect()
        // do checks    
        //return new pagereference('/apex/testVisualForcePageName'); //return a new PageReference    
        //       or    
        //return null to go back to the current page  

Note: We cannot return page reference from the constructor.

Friday, September 14, 2012

Salesforce tabStyle attribute in apex

When you use a custom controller, the tabStyle attribute of an <apex:page> tag allows you to mimic the look and feel of the associated Salesforce page. If you only want portions of the page to be similar to a Salesforce page, you can use the tabStyle attribute on the <apex:pageBlock> tag

tabStyle in <apex:page> tag:
<apex:page standardController="Account" showHeader="true" tabStyle="account" >
For a custom tab we have to add "__tab" after the tab name.
Example: <apex:page standardController="Account" showHeader="true" tabStyle="CustomTab_Name__tab" >

Limitation: Salesforce does not support assigning tabStyle dynamically like below.
<apex:page standardController="Account" showHeader="true" tabStyle="{!vartabStyle}" >

Arithmetic operators not allowed in SOQL queries

Salesforce SOQL queries does not directly support arithmetic operations like below:

SELECT (FieldA+FieldB) FROM Account
SELECT (FieldA+FieldB)*100 FROM Account

We have to use formula fields to achieve this type of requirements.

Simply create a formula field and use it direclty in the query like below:

SELECT FormulaFieldA FROM Account