Salesforce Platform Developer II

Ace your homework & exams now with Quizwiz!

What are the 3 types of sharing?

- Force.com Managed Sharing - User Managed Sharing (Manual Sharing) - Apex Managed Sharing

What fields does each history log table contain?

- ParentId (Id of record field modification happened on) - Field (API name of the modified field) - OldValue (Field value prior to the modification) - NewValue (Field value after modification) - CreatedById (Id of the User who made the modification)

What are the 4 access levels that share objects support and their API names?

- Private (None) - Read Only (Read) - Read / Write (Edit) - Full Access (All)

What 4 properties do all share objects have?

- objectNameAccessLevel (level of access that the specified user or group has been granted for a share sObject) - ParentId (The ID of the object) - RowCause (reason why the user or group is being granted access) - UserOrGroupId (user or group IDs to which you are granting access)

Maximum number of batch Apex job start method concurrent executions?

1 Batch jobs that haven't started yet remain in the queue until they're started. If more than one job is running, this limit doesn't cause any batch job to fail and execute methods of batch Apex jobs still run in parallel.

Calls to the what methods count against the number of DML queries issued in a request. Approval.proces?

1) Approval.process 2) Database.convertLead 3) Database.emptyRecycleBin 4) Database.rollback 5) Database.setSavePoint 6) delete and Database.delete 7) insert and Database.insert 8) merge and Database.merge 9) undelete and Database.undelete 10) update and Database.update 11) upsert and Database.upsert 12) System.runAs

In addition to static SOQL statements, calls to the what methods count against the number of SOQL statements issued in a request?

1) Database.countQuery 2) Database.getQueryLocator 3) Database.query

How do you use a certificate with HTTP requests?

1) Generate a certificate (Setup>Security Controls>Certificate and Key Management). Note: Once you save a Salesforce certificate, you can't change the key size. 2) In your Apex, use the setClientCertificateName method of the HttpRequest class. The value used for the argument for this method must match the Unique Name of the certificate that was generated. HttpRequest req = new HttpRequest(); req.setClientCertificateName('DocSampleCert');

What do SOQL statements evaluate to?

1) List of sObjects 2) Single sObject 3) Integer for count method queries

Name Apex objects that are automatically considered transient.

1) PageReferences 2) XmlStream classes 3) Collections automatically marked as transient only if the type of object that they hold is automatically marked as transient, such as a collection of Savepoints 4) Most of the objects generated by system methods, such as Schema.getGlobalDescribe. 5) JSONParser class instances.

How would you conditionally render an apex:inputText component based on a value of a apex:selectList?

1) Place the apex:inputText box under a component such as a pageBlock. apex:inputText components will not reRender if referenced directly; 2) Under selectList component add an actionFunction with the onChange event and set the reRender attribute to the pageBlock component by it's id attribute. In the controller you will need null PageReference method to set as the action as well. 3) In the apex:inputText component set the rendered attribute to the selectList value that you want to check for (rendered="{!selectListValue == 'valueToCheckFor'}"

How do you use a certificate with SOAP Services?

1) Receive the WSDL for the Web service from the third party or generate it from the application you want to connect to. 2) Generate Apex classes from the WSDL for the Web service. See SOAP Services: Defining a Class from a WSDL Document. 3) The generated Apex classes include a stub for calling the third-party Web service represented by the WSDL document. Edit the Apex classes, and assign a value to a clientCertName_x variable on an instance of the stub class. The value must match the Unique Name of the certificate that you generated on the Certificate and Key Management page. The following example illustrates the last step of the previous procedure and works with the sample WSDL file in Generated WSDL2Apex Code. This example assumes that you previously generated a certificate with a Unique Name of DocSampleCert. docSample.DocSamplePort stub = new docSample.DocSamplePort(); stub.clientCertName_x = 'DocSampleCert'; String input = 'This is the input string'; String output = stub.EchoString(input);

Total number of SOQL queries issued?

1) Sync: 100 2) Async: 200

Name two types of variables that do not get transmitted in the view state.

1) transient 2) static

Total number of records retrieved by Database.getQueryLocator?

10,000

Maximum number of Apex classes scheduled concurrently?

100

Maximum number of batch Apex jobs in the Apex flex queue that are in Holding status?

100

Total number of callouts (HTTP requests or Web services calls) in a transaction?

100

Maximum timeout for all callouts (HTTP requests or Web services calls) in a transaction?

120 seconds

Total number of DML statements issued?

150

Total number of SOSL queries issued?

2,000

Maximum number of batch Apex jobs queued or active concurrently?

5 When batch jobs are submitted, they're held in the flex queue before the system queues them for processing.

Maximum number of Apex jobs added to the queue with System.enqueueJob?

50

Maximum number of methods with the future annotation allowed per Apex invocation?

50

Total number of records retrieved by SOQL queries?

50,000

What is the naming convention for standard object field history log tables?

<ObjectName>History

Annotation. This annotation lets us mark an Apex method as being something that can be called from somewhere other than Apex. Only one method in a class can have the InvocableMethod annotation. The invocable method must be static and public or global, and its class must be an outer class.

@InvocableMethod

To call an Apex method from Process Builder, add the Call Apex action to your process and select an Apex class with an _________ method Annotation.

@invocable

What is a common use of using transient variables to reduce the View State size?

A common use case for the transient keyword is a field on a Visualforce page that is needed only for the duration of a page request, but should not be part of the page's view state and would use too many system resources to be recomputed many times during a request. Example: A page that is refreshed that uses a transient DateTime (it's not stored in the View State, and will update when the page is refreshsed).

With the Process Builder, you can perform the following actions:

Create a record Update any related record Quick action Launch a flow Send an email Post to Chatter Submit record for approval

How are custom object sharing objects named?

CustomObject__Share

What is an example of a standard share object?

AccountShare

Define User Managed Sharing.

Allows the record owner or any user with Full Access to a record to share the record with a user or group of users

What is an asynchronous callout is a callout that is made from a Visualforce page for which the response is returned through a callback method.? It is also something that a developer can implement for a Long-Running Callout.

Apex Continuations. *Note: Know the difference between action:poller, continuation, and httpRequest setTimeout method.

What are the Apex Scheduler limits?

Apex Scheduler Limits: You can only have 100 scheduled Apex jobs at one time. You can evaluate your current count by viewing the Scheduled Jobs page in Salesforce and creating a custom view with a type filter equal to "Scheduled Apex". You can also programmatically query the CronTrigger and CronJobDetail objects to get the count of Apex scheduled jobs. The maximum number of scheduled Apex executions per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater. This limit is for your entire organization and is shared with all asynchronous Apex: Batch Apex, Queueable Apex, scheduled Apex, and future methods. The licenses that count toward this limit are full Salesforce user licenses or Force.com App Subscription user licenses. Chatter Free, Chatter customer users, Customer Portal User, and partner portal User licenses aren't included. Not listed but you can't change a scheduled time in Apex.

What are the Apex Scheduler best practices?

Apex Scheduler Notes and Best Practices: Salesforce schedules the class for execution at the specified time. Actual execution may be delayed based on service availability. Use extreme care if you're planning to schedule a class from a trigger. You must be able to guarantee that the trigger won't add more scheduled classes than the limit. In particular, consider API bulk updates, import wizards, mass record changes through the user interface, and all cases where more than one record can be updated at a time. Though it's possible to do additional processing in the execute method, we recommend that all processing take place in a separate class. Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this method from scheduled Apex. However, if your scheduled Apex executes a batch job, callouts are supported from the batch class. Apex jobs scheduled to run during a Salesforce service maintenance downtime will be scheduled to run after the service comes back up, when system resources become available. If a scheduled Apex job was running when downtime occurred, the job is rolled back and scheduled again after the service comes back up. Note that after major service upgrades, there might be longer delays than usual for starting scheduled Apex jobs because of system usage spikes.

When you need to update or create records of a different object type, an _______ _______ is the best solution.

Apex trigger

What is designed to make it simple to process data from a few thousand to millions of records?

Bulk API Introduction to Bulk API: The Bulk API provides a programmatic option to quickly load your org's data into Salesforce. To use the API requires basic familiarity with software development, web services, and the Salesforce user interface. The functionality described is available only if your org has the Bulk API feature enabled. This feature is enabled by default for Performance, Unlimited, Enterprise, and Developer Editions. When to Use Bulk API: Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, insert, update, upsert, or delete many records asynchronously by submitting batches. Salesforce processes batches in the background. SOAP API, in contrast, is optimized for real-time client applications that update a few records at a time. SOAP API can be used for processing many records, but when the data sets contain hundreds of thousands of records, SOAP API is less practical. Bulk API is designed to make it simple to process data from a few thousand to millions of records. The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. Using Data Loader avoids the need to write your own client application.

How does one access sharing programmatically?

By using the share object associated with the standard or custom object for which you want to share.

What are the compound field limitations?

Compound fields are read-only. To update field values, modify the individual field components. Compound fields are accessible only through the SOAP and REST APIs. The compound versions of fields aren't accessible anywhere in the Salesforce user interface. Although compound fields can be queried with the Location and Address Apex classes, they're editable only as components of the actual field. Read and set geolocation field components by appending "__latitude__s" or "__longitude__s" to the field name, instead of the usual "__c." For example: Double theLatitude = myObject__c.aLocation__latitude__s; myObject__c.aLocation__longitude__s = theLongitude; You can't access or set the compound value You can't use compound fields in Visualforce—for example, in an <apex:outputField>. To access or update field values, use the individual field components. If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field components. Geolocation fields and latitude and longitude on standard addresses aren't supported in the Data Import Wizard. Use the SOAP or REST APIs to import these fields. If you don't have a preferred tool for working with Salesforce APIs, Workbench is an easy way to get started. Custom geolocation and location fields on standard addresses aren't supported with email templates. You can't use compound fields in lookup filters, except to filter distances that are within or not within given ranges. You can use distance lookup filters only in the Metadata API. The only formula functions that you can use with compound fields are ISBLANK, ISCHANGED, and ISNULL. You can't use BLANKVALUE, CASE, NULLVALUE, PRIORVALUE, or the equality and comparison operators with compound fields. The equality and comparison operators include = and == (equal), <> and != (not equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal), && (AND), and || (OR). https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_limitations.htm

What is the namespace for Chatter in Apex?

ConnectAPI The ConnectApi namespace (also called Chatter in Apex) provides classes for accessing the same data available in Chatter REST API. Use Chatter in Apex to create custom Chatter experiences in Salesforce.

Lightning Component - validating fields;

Default Error Handling: The framework can handle and display errors using the default error component, ui:inputDefaultError. The following example shows how the framework handles a validation error and uses the default error component to display the error message. Here is the markup. Custom Error Handling: ui:input and its child components can handle errors using the onError and onClearErrors events, which are wired to your custom error handlers defined in a controller. onError maps to a ui:validationError event, and onClearErrors maps to ui:clearErrors. The following example shows how you can handle a validation error using custom error handlers and display the error message using the default error component. Here is the markup.

What apex component do you use to display validation errors when using a standard controller?

Display Form Errors and Messages Use <apex:pageMessages> to display any form handling errors or messages. Your page should provide useful feedback when things go wrong, such as when a required field is missing, or when a field value fails validation. The standard controller actually handles all of that for you. All you need to do is tell it where to put the messages on the page (as under a pageBlock where the input fields are located).

What is sharing?

Enables record-level access control for all custom objects, as well as many standard objects

Define PRIVATE sharing access.

Only the record owner and users above the record owner in the role hierarchy can view and edit the record. This access level only applies to the AccountShare object.

______ ______ doesn't support outbound messages ______ ______ doesn't allow us to delete a record

Process Builder

Define Apex Managed Sharing.

Provides developers with the ability to support an application's particular sharing requirements programmatically through Apex or the SOAP API

JavaScript remote actions need be either a _______ or _______ class and must be _______.

Public or global and must be static.

Define Force.com Managed Sharing.

Involves sharing access granted by Force.com based on record ownership, the role hierarchy, and sharing rules

Apart from this, the main difference between the "two" action support and action function is that, the action function can also be called from _____.

JavaScript

What do SOSL statements evaluate to?

List of lists of sObjects FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead]; From searchList, you can create arrays for each object returned: Account [] accounts = ((List<Account>)searchList[0]); Contact [] contacts = ((List<Contact>)searchList[1]); Opportunity [] opportunities = ((List<Opportunity>)searchList[2]); Lead [] leads = ((List<Lead>)searchList[3]);

How would you design a test method for mixed DML operations?

Mixed DML Operations in System.runAs Blocks: Use @future to Bypass the Mixed DML Error in a Test Method

How would a developer support a Multi Language visualforce page?

Multi Language Support In order to translate labels that appear in your Visualforce pages, the translation workbench must be enabled for your organization. You will need to use the translation workbench to translate the standard and custom object labels. And you can use the custom labels feature to create translated labels for any type of text you want to use in your Visualforce pages. The following example shows a copyright label that is translated into the Spanish. Sites translation.png You can use these labels in Visualforce pages using the following syntax: {!$Label.copyright} The label will be rendered based on the user's language or the page language. You can set the Site level language via Site Details | Public Access Settings | Show Users | Edit user details. You can also set the page language by passing a parameter to the page via the URL as follows: Define the language parameter for your page <apex:page language="{!$CurrentPage.parameters.lang}">

What is an example of custom share object?

MyCustomObject__Share

What is the format for sharing reasons?

MyReasonName__c

What is the naming convention for custom object field history log tables?

My_Object_History

Are org-wide defaults tracked within an object's share object?

No

Do objects on the details side of a master-detail relationship have an associated sharing object?

No

What tool in the Developer Console contains information on SOQL query Cardinality?

Query Plan Tool

What type of exception could you get from the below statement? Account a = [SELECT Id, (SELECT Id FROM Contacts) FROM Account];

QueryException Any problem with SOQL queries, such as assigning a query that 'returns no records' or 'more than one record' to a singleton sObject variable.

What field on a custom object specifies the type of sharing used for a record?

Reason

List future method considerations,

Remember that any method using the future annotation requires special consideration because the method does not necessarily execute in the same order it is called. Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor. You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method. Future methods accept List of Ids

How can sharing reasons be referenced programmatically?

Schema.CustomObject__Share.rowCause.SharingReason__c

How would you test for an external url in a test class?

String google = controller.externalURL().getUrl(); System.assertEquals('http://www.google.com', google);

What is contained in the View State?

The data in the view state should be sufficient to recreate the state of the page when the postback is received. To do this, it stores the following data: All non-transient data members in the associated controller (either standard or custom) and the controller extensions. Objects that are reachable from a non-transient data member in a controller or controller extension. The component tree for that page, which represents the page's component structure and the associated state, which are the values applied to those components. A small amount of data for Visualforce to do housekeeping. View state data is encrypted and cannot be viewed with tools like Firebug. The view state inspector described below lets you look at the contents of view state.

What are the limitations when generating savepoint variables and rolling back the database?

The following limitations apply to generating savepoint variables and rolling back the database: * If you set more than one savepoint, then roll back to a savepoint that is not the last savepoint you generated, the later savepoint variables become invalid. For example, if you generated savepoint SP1 first, savepoint SP2 after that, and then you rolled back to SP1, the variable SP2 would no longer be valid. You will receive a runtime error if you try to use it. References to savepoints cannot cross trigger invocations because each trigger invocation is a new trigger context. If you declare a savepoint as a static variable then try to use it across trigger contexts, you will receive a run-time error. Each savepoint you set counts against the governor limit for DML statements. Static variables are not reverted during a rollback. If you try to run the trigger again, the static variables retain the values from the first run. Each rollback counts against the governor limit for DML statements. You will receive a runtime error if you try to rollback the database additional times. The ID on an sObject inserted after setting a savepoint is not cleared after a rollback. Create an sObject to insert after a rollback. Attempting to insert the sObject using the variable created before the rollback fails because the sObject variable has an ID. Updating or upserting the sObject using the same variable also fails because the sObject is not in the database and, thus, cannot be updated.

Define READ/WRITE sharing access.

The specified user or group can view and edit the record.

Define READ ONLY sharing access.

The specified user or group can view the record only.

Define FULL ACCESS sharing access.

The specified user or group can view, edit, transfer, share, and delete the record. Can only be granted with managed sharing.

When a record is updated and subsequently triggers a workflow rule field update, what is the value of field in Trigger.old?

Trigger.old contains a version of the objects before the specific update that fired the trigger. However, there is an exception. When a record is updated and subsequently triggers a workflow rule field update, Trigger.old in the last update trigger won't contain the version of the object immediately prior to the workflow update, but the object before the initial update was made. For example, suppose an existing record has a number field with an initial value of 1. A user updates this field to 10, and a workflow rule field update fires and increments it to 11. In the update trigger that fires after the workflow field update, the field value of the object obtained from Trigger.old is the original value of 1, rather than 10, as would typically be the case.

In terms of the MVC model, a Visualforce page involves both the _____ and the _____.

View; Controller.\

What are the best practices for optimizing the View State?

When using multiple forms use <apex:actionRegion> to submit portions of the form. Declare Variables as Transient to Reduce View State: An instance variable declared as transient is not saved and is not transmitted as part of the view state. If a certain field is needed only for the duration of the page request and does not need to be part of the view state, declare it as transient. See an example below. Some Apex objects are automatically considered transient Recreate State versus Storing It in View State: View state should ideally contain only work in progress data (the current object being edited, multi-page wizard data, etc.) If you can reconstruct the data during postback, via a SOQL query or a web services call, do that instead of storing it in controller data members. Use Custom Objects or Custom Settings to Store Large Quantities of Read-Only Data: Assume that your controller needs to call a Web service and parse a large response object. Storing it in view state may not even be an option given the size. Marking it as transient would incur the cost of an additional Web service call and parsing it again. In such instances, you could store the parsed response in a custom object and store just the record id to get to the parsed response. Custom settings provide another mechanism to cache data needed by your controller. Accessing custom settings is faster than access to custom objects since custom settings are part of your application's cache and does not require a database query to retrieve the data. Please consult the online documentation for additional details on Custom Setting. Refine Your SOQL to Retrieve Only the Data Needed by the Page: Only retrieve (and store) the fields you need and also filter the data to only retrieve data needed by the page. Refactor Your Pages to Make Its View Stateless: Instead of using apex:commandLink or apex:commandButton components (which need to be inside a apex:form component) to invoke an action, use an apex:outputLink or other non-action method instead and implement the action through an apex:page action attribute - where it makes sense. The following code shows two ways to invoke a controller method called proccessData() - first with a commandLink, and then with an outputLink and auxiliary page.

The new lightning Process builder is an enhanced version of _____ ____.

Workflow rule

Which of the follow be used yogether in DML operations (transaction)? a) Account - AccountShare b) Case - CaseComment c) Opportunity - User d) Account - Order

b) Case - CaseComment d) Account - Order https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_mix_sobjects.htm

Can you catch governor limit exceptions?

You can't catch all exceptions. Tripping governor limits causes a halt of all processing, so no graceful recovery is possible. There are Limit methods that you can use to see the wall of governor limits coming up on you. Limits.getDMLRows() and Limits.getDMLStatements() will tell you how many rows you've touched and how many individual DML statements you've made. You can compare these numbers with the absolute limits which are returned by Limits.getLimitDMLRows() and Limits.getLimitDMLStatements(), respectively.

How does one recalculate apex managed sharing?

You must write an apex class that implements the Database.Batchable interface.

_____________ : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.

apex:ActionFunction

___________ : This is timer component which can send AJAX request on pre-defined interval. Minimum interval is 5 sec and default is 60 sec.

apex:ActionPoller

____________ : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.

apex:ActionSupport

A component that provides support for invoking controller action methods directly from JavaScript code using an AJAX request. An <____________> component must be a child of an <apex:form> component. Unlike <apex:actionSupport>, which only provides support for invoking controller action methods from other Visualforce components, <______________> defines a new JavaScript function which can then be called from within a block of JavaScript code. Note: Beginning with API version 23 you can't place <_________> inside an iteration component — <apex:pageBlockTable>, <apex:repeat>, and so on. Put the <apex:actionFunction> after the iteration component, and inside the iteration put a normal JavaScript function that calls it.

apex:actionFunction

An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an AJAX request is generated. Only the components in the body of the <_________> are processed by the server, thereby increasing the performance of the page.

apex:actionRegion

A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete.

apex:actionStatus

In Visualforce, page state is persisted as a hidden form field that is _______ inserted into a form when the page gets generated. We call this the view state of the page.

automatically

View state data is ____ and can't be viewed with Firebug.

encrypted

To maintain state in a Visualforce page, the Force.com platform includes the state of components, field values, and controller state in a _____ _____ _____.

hidden form element

Triggers can't use _____ methods.

invocable

Note that an <apex:actionRegion> component only defines which components the server processes during a request—it doesn't define what areas of the page are re-rendered when the request completes. To control that behavior, use the _______ attribute on an <apex:actionSupport>, <apex:actionPoller>, <apex:commandButton>, <apex:commandLink>, <apex:tab>, or <apex:tabPanel> component.

rerender

What is the "Reason" field (which specifies the type of sharing for a record) called in Apex or the Force.com API?

rowCause

List trigger context variable considerations.

trigger.new and trigger.old cannot be used in Apex DML operations. You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown. trigger.old is always read-only. You cannot delete trigger.new.

Large view states require longer processing times for each request, including serializing and de-serializing, and encryption and decryption. By reducing your ____ ____ ___, your pages can load quicker and stall less often.

view state size

What is contained in the view state?

• All non-transient data members in the associated controller (either standard or custom) and the controller extensions. • Objects that are reachable from a non-transient data member in a controller or controller extension. • The component tree for that page, which represents the page's component structure and the associated state, which are the values applied to those components. • A small amount of data for Visualforce to do housekeeping. View state data is encrypted and cannot be viewed with tools like Firebug.


Related study sets

CHAPTER 54 (DRUGS ACTING ON UPPER RESPIRATORY TRACT)

View Set

Chapter 8 pt. 3 Launchpad questions

View Set

Oral Pathology Exam #1 Chapter 1,2,3

View Set

Learning How to Learn: Week 4: Part 1

View Set