Salesforce Flashcard Practice 1
46 Questions
100 Views

Salesforce Flashcard Practice 1

Created by
@ImprovingSocialRealism4496

Questions and Answers

What is the purpose of the variable qryName in the code example?

To create a query string that includes the name with wildcards for partial matching.

What is a key difference between Master-Detail Relationship and a Lookup Relationship? (Select all that apply)

  • A Lookup Relationship is a required field on an object
  • A Master-Detail Relationship detail record inherits the sharing and security of its master record (correct)
  • When a record of a master object in a Lookup Relationship is deleted, the detail records are also deleted
  • When a record of a master object in a Master-Detail Relationship is deleted, the detail records are kept and not deleted
  • In the code below, which type does String inherit from? String s = 'Hello World';

  • SObject
  • Prototype
  • Object (correct)
  • Class
  • How many total records will be committed to the database in an Apex transaction that inserts 100 Account records and 2,000 Contact records before a DML exception occurs?

    <p>100</p> Signup and view all the answers

    Which two practices should be used for processing records in a trigger? (Select all that apply)

    <p>Use a Set to ensure unique values in a query filter</p> Signup and view all the answers

    Which two are required in a controller extension to override the Save standard action for a standard controller? (Select all that apply)

    <p>Create a method named Save with a return data type of PageReference</p> Signup and view all the answers

    How can a developer use a Set to limit the number of records returned by a SOQL query?

    <p>Reference the Set in the WHERE clause of the query</p> Signup and view all the answers

    When a Task is created for a Contact, how can a developer prevent the task from being included on the Activity Timeline of the Contact's Account record?

    <p>In Activity Settings, uncheck Roll up activities to a contact's primary account</p> Signup and view all the answers

    From which system monitoring feature can a developer see information about @future methods that were invoked?

    <p>Apex Jobs</p> Signup and view all the answers

    What is a benefit of using a trigger framework?

    <p>Simplifies addition of context-specific logic</p> Signup and view all the answers

    Managed Packages can be created in which type of org?

    <p>Developer Edition</p> Signup and view all the answers

    How can a developer warn users of SOQL governor limit violations in a trigger?

    <p>Use Limits.getQueries() and display an error message after the number of SOQL queries exceeds the limit</p> Signup and view all the answers

    Which line of code is causing an 'after update' trigger on the Account object to fail?

    <p>03: A SOQL query is located inside of the for loop</p> Signup and view all the answers

    Which two roll-up summary field types are required to find the average of values on detail records in a Master-Detail relationship? (Select all that apply)

    <p>Roll-up summary field of type SUM</p> Signup and view all the answers

    What data model provides the simplest solution to allow people to be related to their employer?

    <p>Create a lookup relationship to indicate that a person has an employer</p> Signup and view all the answers

    In which two ways can a developer provide a way to mass edit, update, and delete records from a list view? (Select all that apply)

    <p>Download an unmanaged package from the AppExchange that provides customizable mass edit, update and delete functionality</p> Signup and view all the answers

    Given the code 'Opportunity opp = [SELECT Id, Stagename FROM Opportunity LIMIT 1];', how can a developer get the label for the Stagename field?

    <p>Call 'opp.StageName.getDescribe().getLabel()'</p> Signup and view all the answers

    The onclick attribute for a lightning:button component references a JavaScript function in which resource in the component bundle?

    <p>Controller.js</p> Signup and view all the answers

    Which statement is true about developing in a multi-tenant environment?

    <p>Governor limits prevent Apex from impacting the performance of multiple tenants on the same instance</p> Signup and view all the answers

    Which two components are available to deploy using the Metadata API? (Choose 2 answers)

    <p>Account Layout</p> Signup and view all the answers

    In the provided class and trigger code, which code segment should be inserted to set the baseCost variable to the value of the class variable smokerCharge?

    <p>InsuranceRates.smokerCharge</p> Signup and view all the answers

    What should a developer do to successfully deploy if a change set deployment from a sandbox to production fails due to a failure in a managed package unit test?

    <p>Select 'Run local tests' to run all tests in the org that are not in the managed package</p> Signup and view all the answers

    Which three attributes need to be defined in the apex:commandButton tag for a custom Visualforce button on the Opportunity object page layout?

    <p>Action</p> Signup and view all the answers

    Which two statements can a developer use to throw a custom exception of type MissingFieldValueException?

    <p>throw new MissingFieldValueException('Problem occurred');</p> Signup and view all the answers

    What must be done in the second test method to use an Account if the first test method deletes the Account record?

    <p>Use SELECT Id from Account where Name = 'Test'</p> Signup and view all the answers

    What should a developer do to deploy to production after creating a Visualforce page and a custom controller?

    <p>Create a test class that provides coverage of the custom controller</p> Signup and view all the answers

    Which invocation of a method in the declared class will obey the organization-wide defaults and sharing settings?

    <p>A developer using the Developer Console that invokes a method in this class from the execute anonymous window</p> Signup and view all the answers

    How many levels of child records can be returned in a single SOQL query from one parent object?

    <p>1</p> Signup and view all the answers

    Which three are valid assignments for a custom formula field Level__c defined as a Formula (Number) with two decimal places?

    <p>Double myLevel = acct.Level__c</p> Signup and view all the answers

    Which two options allow a developer to dynamically determine the ID of the required Record Type by its name?

    <p>Execute a SOQL query on the RecordType object</p> Signup and view all the answers

    Which two statements are true regarding formula fields?

    <p>Formula fields may reference formula fields on the same object to a level of one deep</p> Signup and view all the answers

    What is the result if the Case update exceeds the governor limit for maximum number of DML records?

    <p>The Account save fails and no Contacts or Cases are updated</p> Signup and view all the answers

    Which option should a developer use to create 500 Accounts and ensure that duplicates are not created for existing Account Sites?

    <p>Data Import Wizard</p> Signup and view all the answers

    Which attribute must the developer include in the apex:page tag to ensure the Visualforce page can be embedded in a page layout?

    <p>standardController='Account'</p> Signup and view all the answers

    Which two SOSL searches will return records matching search criteria contained in any of the searchable text fields on an object?

    <p>[FIND 'Acme*' IN ALL FIELDS RETURNING Account, Opportunity]</p> Signup and view all the answers

    What are two benefits of the Lightning Component framework?

    <p>It provides an event-driven architecture for better decoupling between components</p> Signup and view all the answers

    Which two actions should a developer take to create an employee rating program allowing employees to rate each other?

    <p>Create a lookup relationship between the Rating and Employee object</p> Signup and view all the answers

    Which field type should a developer choose to store a description of a product that can be entered on separate lines?

    <p>Text Area</p> Signup and view all the answers

    Which two actions should a developer perform to get available picklist values and record types for the Opportunity object?

    <p>Use Schema.PicklistEntry returned by Opportunity.StageName.getDescribe().getPicklistValue()</p> Signup and view all the answers

    What can the user expect to see when accessing the custom page created by the specified controller?

    <p>a,a,a</p> Signup and view all the answers

    For which example task should a developer use a trigger rather than a workflow rule?

    <p>To set the primary Contact on an Account record when it is saved</p> Signup and view all the answers

    Which is a valid Apex assignment?

    <p>Double x=5</p> Signup and view all the answers

    Which type of code represents the Model in the MVC architecture on the Force.com platform?

    <p>A list of Account records returned from a Controller Extension method</p> Signup and view all the answers

    Which declarative process automation feature supports iterating over multiple records?

    <p>Flows</p> Signup and view all the answers

    Which approach should a developer use to make total hours for each timecard available to application users?

    <p>A Roll-Up Summary field on the Timecard Object that calculates the total hours from the timecard entries for that timecard</p> Signup and view all the answers

    Which two queries can a developer use in a Visualforce controller to protect against SOQL injection vulnerabilities?

    <p>String qryName = '%' + name + '%'; String qryString = 'SELECT Id FROM Contact WHERE Name LIKE :qryName'; List queryResult = Database.query(qryString);</p> Signup and view all the answers

    Study Notes

    Mass Record Editing

    • Mass editing, updating, and deleting in list views can be achieved by using:
      • Unmanaged package from AppExchange providing customizable functionality.
      • Creating a Visualforce page with an Apex Controller for mass actions.

    Retrieving Field Labels

    • To access the label of the Stagename field for an Opportunity, use:
      • Opportunity.StageName.getDescribe().getLabel()

    Handling Button Click Events

    • Click events for lightning:button components are handled in:
      • The Controller.js resource of the component bundle.

    Developing in Multi-Tenant Environment

    • Governor limits ensure that Apex performance does not adversely affect other tenants sharing the same platform.

    Deployable Components with Metadata API

    • Deployable components via the Metadata API include:
      • Account Layout
      • Case Layout

    Class Variable Access in Triggers

    • To set a variable to a class variable in a trigger, use:
      • InsuranceRates.smokerCharge

    Change Set Deployment Issues

    • If a change set deployment fails due to managed package unit tests, select:
      • 'Run local tests' to execute all tests in the org that are not in the managed package.

    Custom Visualforce Button Attributes

    • Required attributes for a custom Visualforce button include:
      • Action
      • Extensions
      • StandardController

    Throwing Custom Exceptions

    • To throw a custom exception of type MissingFieldValueException, you can use:
      • throw new MissingFieldValueException('Problem occurred')
      • throw new MissingFieldValueException()

    Reusing Test Setup Methods

    • Within test methods, use:
      • SELECT Id FROM Account WHERE Name = 'Test' to access previously created records.

    Coverage for Deployment

    • For deploying Visualforce pages and custom controllers, create a test class that covers:
      • The custom controller.

    Method Invocation and Sharing Settings

    • Method invocations using the Developer Console respect organization-wide defaults and sharing settings.

    SOQL Query Child Records Limit

    • SOQL allows accessing a maximum of:
      • 1 level of child records in a single query from a parent object.

    Valid Assignments for Formula Fields

    • Valid assignments from a custom formula field (Number) include:
      • Double and Decimal types.

    Dynamic Record Type Identification

    • To dynamically determine Record Type ID:
      • Use getRecordTypeInfosByName() from DescribeSObjectResult or execute a SOQL query on the RecordType object.

    Formula Fields Rules

    • Formula fields can reference other formula fields only one level deep.
    • Deleting referenced fields requires modification of the formula.

    DML Records Governor Limits and Outcomes

    • If the DML update exceeds governor limits:
      • The Account save fails, resulting in no updates to Contacts or Cases.

    Importing Accounts Without Duplicates

    • Use the Data Import Wizard for importing accounts while avoiding duplicate entries based on existing Account Sites.

    Visualforce Page Embedding

    • To embed a Visualforce page in an Account layout, include:
      • standardController="Account" in the <apex:page> tag.

    Searching with SOSL

    • Queries matching search criteria in any searchable fields include:
      • [FIND 'Acme*' RETURNING Account, Opportunity]
      • [FIND 'Acme*' IN ALL FIELDS RETURNING Account, Opportunity]

    Lightning Component Benefits

    • Benefits of the Lightning Component framework:
      • Event-driven architecture for improved component decoupling.
      • Accelerated development using pre-built components for all devices.

    Employee Rating Program Implementation

    • To implement the rating program:
      • Create a lookup relationship between the Rating and Employee objects.
      • Use a trigger on the Rating object to update Employee records.

    Storing Searchable Descriptions

    • For searchable product descriptions in SOQL queries, use:
      • Text Area field type.

    Visualforce Page Picklist Values Retrieval

    • To get picklist values and record types for Opportunity:
      • Use Schema.PicklistEntry from Opportunity.StageName.getDescribe().
      • Use Schema.RecordTypeInfo from Opportunity.SObjectType.getDescribe().

    Custom Controller Functionality

    • Expected output on accessing the custom page includes values based on the method calls in the custom controller.

    Trigger vs. Workflow

    • Triggers should be used for tasks like:
      • Setting the primary Contact on an Account record upon saving.

    Valid Apex Assignments

    • A valid assignment involving decimal numbers is:
      • Double x = 5

    Model in MVC on Force.com

    • The model in MVC is represented by:
      • A list of Account records returned from a Controller Extension method.

    Processing Records in Triggers

    • Best practices when processing records in triggers:
      • Utilize a Map for efficient SOQL calls.
      • Utilize a Set to maintain unique query values.### Future Methods and DML Operations
    • Utilize @future methods to perform DML operations asynchronously, improving overall application performance.
    • Implement a Map to minimize SOQL calls by grouping records.
    • Use a Set to maintain distinct values when filtering queries.

    Controller Extension Requirements for Save Action

    • Construct the controller extension with a constructor accepting an instance of StandardController.
    • Implement a method named Save with a return type of PageReference to override the standard Save action.

    SOQL Query Limitations with Sets

    • Leverage a Set in the WHERE clause of a SOQL query to restrict the results returned based on unique values contained in the Set.

    Task and Activity Timeline Management

    • Adjust Activity Settings to prevent tasks from appearing on the Activity Timeline of a Contact’s Account by unchecking the roll-up activities option.

    Monitoring @Future Method Invocations

    • Use the Apex Jobs system monitoring feature to review details of invoked @future methods.

    Benefits of a Trigger Framework

    • Enhance trigger maintenance and testing by isolating trigger logic from the trigger itself.
    • Standardize triggers for consistent operation across the application.
    • Control the order of execution with a single trigger per object.

    Managed Packages Creation

    • Managed Packages can only be built in a Developer Edition org.

    SOQL Governor Limit Alerts in Triggers

    • Implement Limits.getQueries() to notify users of impending SOQL governor limit violations in triggers.

    Common Trigger Failures

    • Ensure SOQL queries are not placed within loops to prevent execution errors and governor limit issues.

    Roll-Up Summary Fields and Averages

    • To calculate averages in a Master-Detail relationship, utilize both a SUM roll-up summary field and a COUNT roll-up summary field.

    Data Modeling for Employer Relationships

    • Establish a simple lookup relationship to associate individuals with their employers rather than more complex junction objects.

    Code Block Analysis

    • Ensure that loop logic and variable initialization are correctly designed to avoid execution failures.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge on managing records in Salesforce with these flashcards. This quiz will help you understand the various methods for mass editing, updating, and deleting records effectively.

    More Quizzes Like This

    Salesforce Data Architect Flashcards
    54 questions
    Salesforce Apex Developer Practices
    28 questions
    Use Quizgecko on...
    Browser
    Browser