Wednesday, 14 May 2014

Salesforce Dev 401 Certification Questions...

Salesforce Dev 401 (Dumps-2)

1. What is a junction object?
a. Object with lookup relationship
b. Master detail relationship
c. Object with two lookup relationships
d. Object with two Master-Detail relationships

Ans. d

2. In a Master-Detail relationship, what happens when the a record is deleted from the parent object?
a. Parent record alone gets deleted
b. Exception occurs
c. Parent and child record will not be deleted
d. All child records are deleted


Ans. c

3. Object X has a lookup to object Y. Which of the following statements are TRUE? Please choose two (2).
a. Fields of both X and Y are accessible from object Y
b. Fields of object Y can be accessed from object X
c. Fields of both Y and X are accessible from object X
d. Fields of object X can be accessed from object Y

Ans. b,c

4. What are the components of the dashboard that use grand totals? Please choose two (2) items.
a. Chart
b. Metric
c. Table
d. Gauge

Ans. b,d

5. How do you highlight totals in a report?
a. Roll-up summary field
b. Formula field
c. Custom summary field
d. Summary totals

Ans. d

6. In Master-Detail relationship scenario the fields of the parent object need to be displayed in the related list. How will a developer design this?
a. Cross-object formula field
b. Workflow rule
c. Validation rule
d. Assignment rule

Ans. a

7. What field can be controlled by a translation workbench?
a. Rule criteria
b. Formula
c. Validation errors
d. Assignment rules

Ans. d

8. What will cause the analytic snapshots run to fail? Please select three (3) choices.
a. The source report has been deleted
b. The target object has a trigger on it
c. The running user has been inactivated
d. The target object is a custom object
e. The source report is saved as matrix report

Ans. a,b,c

9. How does Salesforce enforce data access using role hierarchy?
a. Users are given access to the records owned by the users who are below them in the role hierarchy
b. Users are given access to the records owned by the users who share the same role in the role hierarchy
c. Users are given access to the records accessible by the users who are below them in the role hierarchy
d. Users are given access to the records accessible by the users who are above the role hierarchy

Ans. a

10. When you create a custom tab for a custom object, what are the features that are available by default? Please select two (2) choices.
a. Sidebar search object
b. Custom reporting
c. Recent Items
d. Ability to track activity

Ans. a,c

11. In a recruiting application a position that is of type critical should not be kept open for more than 14 days. How will you develop the business logic to cater to this?
a. Time-dependant workflow action to send an e-mail to the owner after 14 days
b. Time-dependant workflow action to send the record for review to owner after 14 days
c. Time-dependant workflow action to send an e-mail to the owner before 14 days
d. Time-dependant workflow action to close the position after 14 days

Ans. a

12. A job application object has a child review object to store candidate reviews. The review needs to be tracked between a score of 1 to 5. The score has to be a choice between 1 and 5 displayed as a radio button. How will a developer cater to this requirement?
a. Create 5 fields for scores (1 to 5) of type radio-button and use it in review page layout
b. Create a dependent picklist that feeds the radio button type field
c. Create a formula field
d. Create a Visualforce page with radio buttons for the review object

Ans. d

13. In a data model object A is related to B, B is related to C. How will a developer create a report to include fields of A and C?
a. Create lookup relationships between A,B and C
b. Create a custom report type with A, B and C, and use it in the report
c. Create a custom report with A and C fields as relationships already exist
d. Report cannot be created

Ans. b

14. An application was designed without considering whether requirements for reports include dashboards. Out of the following statements which one is TRUE?
a. The data model will support all the requirements of the application, including reports and dashboards
b. Reports are part of the application and application design will take care of it
c. No special considerations for reports or dashboards are required as Salesforce can natively take care of the requirements
d. The data model and the application will not cater for reports and dashboards

Ans. d

15. A recruiting application has a position object that contains location, department and other information relating to a position. We need to create a report that is grouped by department but not by locations. What is the best type of report a developer would choose?
a. Summary report
b. Tabular report
c. Matrix report
d. A report using Visualforce

Ans. a

Salesforce Dev 401 Certification Questions...

Salesforce Dev 401 (Dumps-1)

1. Standard fiscal years can start on the first day of any month of the year ?
A.True
B.False

Ans. A

2. The organization IDs of your sandboxes remain same each time your sandbox is refreshed
A. TRUE
B. FALSE

Ans. B

3. An opportunity can have only one primary partner
A. TRUE
B. FALSE

Ans. a

4. Which of the following is not a correct statement?
A. Tags can be enabled by enabling Tags permission for the Organization
B. Tags can be enabled by enabling Tags permission for the Profiles
C. Tags can be added on the Records
D. Tags can be accessed from the Sidebar component

Ans. b

5. Encrypted fields are editable regardless of whether the user has the “View Encrypted Data” permission.
A. True
B. False

Ans. A

6. Which of the following can not be done via Workflow ?
A.Create a Task
B.Create an Event
C.Create an Email Alert
D.Create an Outbound Message

Ans. b

7. Roll Up Summary fields work in which kind of relationship ?
A.Many to Many Relationship
B.One to One Relationship
C.Master - Detail Relationship
D.Lookup Relationship

Ans. c

8. Which functionality cannot be achieved by final rejection action in an Approval Process ?
A.Change the status of a field to “Rejected”
B.Send an email notification
C.Unlock the record
D.Delete the Record

Ans. D

9. Which feature is used to Report on Historical Data ?
A.Reports
B.Dashboards
C.Analytical Snapshot
D.Mobile Lite
E.Entitlements

Ans. C

10. Folders are used in Salesforce.com to store ?
A.Reports, Dashboards, Documents and Email templates
B.Reports, Dashboards and Documents
C.Dashboards, Documents and Email templates
D.Reports and Dashboards

Ans. A

11. Which of the following can be done by the Pagelayout Editor ?
A.Make a Field Mandatory
B.Make a Field Read-Only
C.Both A & B
D.None of Above

Ans. c

12. Which of the following is not allowed ?
A.Master (Custom object) and Detail (Standard object)
B.Master (Custom object) and Detail (Custom object)
C.Look Up between (Standard object) and (Standard object)
D.Look Up between (Standard object) and (Custom object)

Ans. A

13. How many different Master – Detail relationships can exist on the detail object side ?
A.1
B.2
C.3
D.4

Ans. B

14. What happens when a parent record is deleted in the Parent Child model having a Lookup Relationship between Parent - Child Objects ?
A.Child records are also deleted
B.Shows an error
C.Cant delete the record
D.Child records are not deleted

Ans. d

15. Can Data Loader be run through the Command Line ?
A.Yes
B.No

Ans. A

Friday, 9 May 2014

Creating an Apex Class Using the Developer Console

Creating an Apex Class Using the Developer Console...


1. Click Your Name > Developer Console to open the Developer Console.

2. Click File > New > Apex Class.

3. Enter HelloWorld for the name of the new class and click OK.

4. A new empty HelloWorld class is created. Add a static method to the class by

adding the following text between the

braces:

public static void sayYou() {

System.debug( 'You' );
}
5. Add an instance method by adding the following text just before the final closing brace:
public void sayMe() {
System.debug( 'Me' );
}

6. Click Save.


You’ve created a class called HelloWorld with a static method sayYou() and an
instance method sayMe() . Looking at the definition of the methods,
you’ll see that they call another class, System , invoking the method debug() on that class, which will output strings.

If you invoke the sayYou() method of your class, it invokes the debug() method of the System class, and you see the output.


 
Now How To Calling a Class Method

Now that you’ve created the HelloWorld class, follow these steps to call its methods.

1. Execute the following code in the Developer Console to call the HelloWorld
class's static method.
 You might have to delete any existing code in the entry panel. Notice that to call a static method, you don’t have to create an instance of the class. HelloWorld.sayYou();

2. Open the resulting log.

3. Set the filters to show USER_DEBUG events. (Also covered in Tutorial 2). “You” appears in the log

4. Now execute the following code to call the HelloWorld class's instance method. Notice that to call an instance method,
you first have to create an instance of the HelloWorld class.
HelloWorld hw = new HelloWorld();
hw.sayMe();

5. Open the resulting log and set the filters.

6. “Me” appears in the Details column. This code creates an instance of the HelloWorld class, and assigns it to a variable
called hw . It then calls the sayMe() method on that instance.

7. Clear the filters on both logs, and compare the two execution logs. The most obvious differences are related to creating
the HelloWorld instance and assigning it to the variable hw . Do you see any other differences?

Congratulations—you have now successfully created and executed new code on the Force.com platform!

Thursday, 8 May 2014

Integrate Google Map with Visual Force




Go to Your Name » Setup » Develop » Pages

Copy/paste the following code into a new Page replacing what appears by default.  Notice that in this example we're using custom fields for the Account address components:

<apex:page standardController="Account">
<apex:pageBlock >
<head>
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 
 
$(document).ready(function() {
  
  var myOptions = {
    zoom: 20,
    mapTypeId: google.maps.MapTypeId.HYBRID,
    mapTypeControl: true
  }
  
  var map;
  var marker;
  
  var geocoder = new google.maps.Geocoder();
  var address = "{!Account.Project_Street_Address__c}, " + "{!Account.Project_City__c}, " + "{!Account.Project_Zipcode__c}";
  
  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b>"
  });
 
  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
      
        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);
      
        //center map
        map.setCenter(results[0].geometry.location);
        
        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });
        
        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });
        
      }
      
    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!Account.Name}'s address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });
  
  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
});
</script>
 
<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:500px;
  background:transparent;
}
</style>
 
</head>
 
<body>
<div id="map"></div> 
</body> 
</apex:pageBlock>
</apex:page>

How To use Extensions In Visualforce page in Salesforce


Visualforce page


<apex:page standardController="Account" extensions="myextension">
    <p>{!title}</p>   
    <apex:form >
        <apex:inputField value="{!account.name}"/>

        <apex:commandButton value="Save" action="{!save}"/>
    </apex:form>
</apex:page>


extensions



public class myextension {
    private final account ac;
   
    public myextension(Apexpages.standardcontroller controller){
        this.ac =(Account)controller.getRecord();
    }
    public String getTitle(){
        return 'Account:' + ac.name + '(' + ac.id + ')';

    }
}





How To view or update three objects records in one visualforce page through custom controller




Visualforce page code

<apex:page controller="threeobjects">
    <apex:pageBlock >
    <apex:form >
    <apex:inlineEditSupport />
        <apex:pageBlockSection columns="3" >
            <apex:pageBlockTable value="{!accountname}" var="a">
                <apex:column headerValue="Accounts" >
                <apex:outputField value="{!a.name}"/>
                </apex:column>
            </apex:pageBlockTable>
            <apex:pageBlockTable value="{!contactname}" var="c">
                <apex:column headerValue="Contacts" >
                <apex:outputField value="{!c.name}"/>
                </apex:column>
            </apex:pageBlockTable>
            <apex:pageBlockTable value="{!opportunityname}" var="o">
                <apex:column headerValue="Opportunities" >
                <apex:outputField value="{!o.name}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
  
        <apex:commandButton value="Save" action="{!save}"/>
        </apex:form>
    </apex:pageBlock>
</apex:page>




Controller

public class threeobjects {
    public list<account> accountname{get; set;}
    public list<contact> contactname{get;set;}
    public list<opportunity> opportunityname{get; set;}

    public threeobjects(){
        accountname = [select name from account limit 10];
        contactname = [select name from contact limit 10];
        opportunityname = [select name from opportunity limit 10];
    }
    public PageReference save() {
        update accountname;
        update contactname;
        update opportunityname;
        return null;
    }
}