Salesforce Platform Developer II Interview Questions

  1. Home
  2. Salesforce Platform Developer II Interview Questions
Salesforce Platform Developer II Interview Questions

The most critical stage in achieving exam achievement is to prepare for a job interview. One of the most important milestones in your career will be the job interview. Because this is your finest chance to impress recruiters and create an indelible impression by performing at your best. However, it is critical to understand the fundamentals of an interview before attending. Before beginning to prepare for the Salesforce Platform Developer II interview round, bear the following items in mind:

  • Firstly, Research about the company
  • Research about the job roles and responsibilities
  • Thinking about wearing decent \ formals for the interview
  • Having good communication skills
  • Build yourself on confidence
  • Preparing for questions that will be asked in the interview
  • Lastly, following up with the recruiters.

Moreover, we have discussed the Salesforce Platform Developer II Interview Questions and answers in the following sections. So candidates that are appearing for this exam tend to lack with the interview round, due to some reasons like not having much information regarding the company, job role and most importantly unaware of the most probable questions asked in the interview. Therefore, follow us to boost your interview skills to ace the interview with flying colors.

About the exam:

The Salesforce Platform Developer II exam is specially intended for candidates who has experience developing custom applications on the Lightning Platform, including practical application of the skills and concepts noted in the exam objectives below.

  • Understands the principles and best practices of Salesforce data modeling, interface design, code development, and testing, and can apply these principles in real-world development environments.
  • Is competent in tuning Visualforce pages and understands the performance implications of the controller design.
  • Understands and applies best practices for general web and Salesforce-specific security concerns.
  • Can design and implement complex sharing models using declarative and programmatic methods.
  • Understands and uses asynchronous programming – queueable, batchable, schedulable, etc.
  • Understands and applies appropriate techniques for error and exception handling in various programmatic contexts.
  • Also, has knowledge of Jest testing for Lightning web components.

Now let’s begin with Salesforce Platform Developer II Interview Questions.

Advanced Interview Questions

Can you explain the difference between a Master-Detail relationship and a Lookup relationship in Salesforce?

In Salesforce, a Master-Detail relationship is a type of relationship where the child object is dependent on the parent object and if the parent object is deleted, the child object will also be deleted. The child object inherits the security and sharing settings of the parent object. This relationship creates a parent-child relationship between two objects and is represented by a solid line.

A Lookup relationship, on the other hand, is a type of relationship where the child object is not dependent on the parent object and can exist independently of the parent object. If the parent object is deleted, the child object will not be affected. The child object does not inherit the security and sharing settings of the parent object. This relationship creates a many-to-one relationship between two objects and is represented by a dotted line.

In summary, the Master-Detail relationship creates a dependency between objects, while the Lookup relationship creates a reference between objects.

How do you handle governor limits in Apex?

  1. Monitor usage: Keep track of your governor limits by monitoring the usage of your Apex code. This will help you identify any areas where you may be approaching or exceeding limits.
  2. Optimize code: Look for ways to optimize your Apex code to reduce the number of governor limits used. For example, use bulkified code, avoid using SOQL and DML statements in loops, and use caching techniques.
  3. Use asynchronous processing: Use Apex asynchronous processing, such as Queueable Apex or Batch Apex, to spread out the processing of large amounts of data and avoid hitting governor limits.
  4. Limit external calls: Limit the number of external calls, such as calls to external web services, as these can also consume governor limits.
  5. Test and debug: Test your Apex code in a sandbox environment to identify any governor limit issues before deploying it to production. Use the Apex Debugger to identify and fix any issues with your code.
  6. Request a limit increase: If you are consistently hitting governor limits, you can request an increase in your governor limits from Salesforce. This should be done as a last resort, after all, other measures have been taken.

Can you explain the difference between a before trigger and an after trigger in Salesforce?

In Salesforce, a trigger is a piece of Apex code that gets executed automatically before or after a specific event occurs, such as before or after a record is inserted, updated, or deleted.

A before trigger runs before the data is saved in the database, allowing you to validate or modify the data before it’s committed to the database. You can use a before trigger to make sure that the data meets certain conditions before it’s saved. This can include things like validating the input data, calculating field values, or updating related records.

An after trigger runs after the data is saved in the database, allowing you to access the saved data and perform additional actions based on the saved data. You can use an after trigger to perform tasks such as sending an email, updating other fields, creating a new record, or updating a related record.

In summary, Before triggers are executed before the data is saved and can be used to manipulate or validate the data before it’s saved in the database, while after triggers are executed after the data is saved and can be used to access the saved data and perform additional actions based on the saved data.

How do you test Apex code in Salesforce?

There are several ways to test Apex code in Salesforce:

  • Apex Test Execution: You can run individual Apex tests or a group of tests from the Developer Console or from the command line using the Salesforce CLI. The tests will be run in a separate, isolated context, and any data created or modified during the test will be rolled back at the end of the test, ensuring that your tests don’t affect your production data.
  • Salesforce Test Classes: Salesforce provides a built-in testing framework for Apex, which allows you to write and run test methods that assert the expected behavior of your code. You can create test classes and test methods that use the @isTest annotation, and run them using the runAllTests() method or by using the Salesforce UI.
  • Apex Replay Debugger: This is a new way to test your Apex code and it allows you to debug your Apex code by replaying the debug logs. This is available in the developer console and you can use this to test the Apex code using the context of the original transaction, which can be useful to test the Apex code that is executed during the update or insert of the record.
  • Apex Code Coverage: Salesforce provides a built-in code coverage tool that allows you to check how much of your Apex code is covered by your test methods. This can help you identify any areas of your code that are not being properly tested, so you can write additional test methods to increase coverage.
  • Sandbox Testing: You can create a Sandbox of your production org, and test your Apex code in a safe environment, that doesn’t affect your production data.

In summary, You can use Salesforce’s built-in testing framework, Apex Test Execution, Apex Replay Debugger, Apex Code Coverage, and Sandbox Testing to test your Apex code in Salesforce.

Can you explain how Salesforce’s data model works?

In Salesforce, data is organized into objects, which are similar to tables in a relational database. Each object has a set of fields, which are similar to columns in a table, that store the data for the object. Objects can be related to each other in different ways, such as one-to-many, many-to-many, or lookup relationships. These relationships allow you to create links between objects, such as linking a contact to an account or linking a case to an opportunity. Objects can be customized to meet the specific needs of your organization, such as adding new fields, creating custom page layouts, or creating custom workflows.

In addition to objects, Salesforce also has standard and custom fields. Standard fields are predefined fields that come with Salesforce objects and are used to store basic information such as name, email, and phone number. Custom fields can be created to store additional data that is specific to your organization. Salesforce also has a feature called record types, which allows you to define different sets of fields, page layouts, and business processes for different types of records within an object. This allows you to create different record types for different types of accounts, such as business accounts, educational accounts, and government accounts.

In summary, Salesforce’s data model is based on objects, which are similar to tables in a relational database. Each object has a set of fields that store data, and objects can be related to each other in different ways, such as one-to-many, many-to-many, or lookup relationships. Salesforce also has standard and custom fields, and record types that allow you to define different sets of fields, page layouts, and business processes for different types of records within an object.

How do you implement role-based access in Salesforce?

  1. Create roles: Create roles in Salesforce that correspond to the different levels of access that users need. For example, you may have roles for administrators, managers, and regular users.
  2. Assign users to roles: Assign users to the appropriate roles based on their job function and level of access required.
  3. Set up profiles: Set up profiles for each role and assign the appropriate permissions and access levels for each profile. For example, administrators may have full access to all objects and fields, while regular users may only have access to a subset of objects and fields.
  4. Create sharing rules: Create sharing rules to control access to specific records or objects. For example, you may want to limit access to certain sensitive data to only certain users or roles.
  5. Test and review: Test the role-based access implementation by logging in as users with different roles and verifying that they have the correct access levels. Review the access levels regularly and make adjustments as needed.
  6. Monitor users’ access: Keep track of who is doing what by monitoring the user’s access history. This will help you identify any potential security breaches or access violations.

Can you explain the difference between a static and a non-static method in Apex?

In Apex, methods are used to encapsulate functionality and can be either static or non-static.

A static method is a method that can be called on a class, rather than an instance of the class. This means that static methods don’t require an instance of the class to be created before they can be called. They can be called directly on the class, using the class name, and don’t have access to the instance-specific data or methods of the class. Static methods are often used to provide utility functions, such as string manipulation or mathematical operations, that don’t depend on the specific state of an instance.

A non-static method, also known as an instance method, is a method that can only be called on an instance of a class. This means that an instance of the class must be created before the method can be called. Non-static methods have access to the instance-specific data and methods of the class and can be used to perform operations that depend on the specific state of an instance.

A static method can be called directly on the class and doesn’t require an instance of the class to be created before it can be called. While a non-static method can only be called on an instance of a class and has access to the instance-specific data and methods of the class.

In summary, a static method is a method that can be called directly on the class, doesn’t require an instance of the class to be created before it can be called, and doesn’t have access to the instance-specific data or methods of the class. While a non-static method, can only be called on an instance of a class, has access to the instance-specific data and methods of the class, and require an instance of the class to be created before it can be called.

Can you explain the process of creating a custom object in Salesforce?

Creating a custom object in Salesforce is a straightforward process that can be done in a few steps:

  1. Go to the Setup menu, and under the ‘Build’ section, click on the ‘Create’ button.
  2. Click on ‘Objects’ and select ‘New Custom Object’.
  3. Enter the object’s name, label, and plural label. The name is the API name for the object, and the label and plural label will be displayed in the user interface.
  4. Select the appropriate data type for the object, such as text, number, date, or picklist.
  5. Define the object’s fields by clicking on ‘New’ and entering the field name, data type, and other field-specific information.
  6. Set up the object’s page layouts by determining which fields should be visible and how they should be displayed.
  7. Create any related lists or custom buttons that you want to associate with the object.
  8. Create any required validation rules or workflows that need to be applied to the object.
  9. Configure the object’s security settings, such as sharing rules or field-level security.
  10. Finally, activate the object and add it to the appropriate apps and tabs.

Once the custom object is created, you can use it to create and track data specific to your business processes, such as leads, opportunities, or cases.

How do you perform a field update using Apex?

To perform a field update using Apex, you can use the following syntax:

SObject record = [SELECT Id FROM SObject WHERE Condition];

record.fieldName = newValue;

update record;

Replace SObject with the specific object you want to update, Condition with the condition that identifies the record you want to update, fieldName with the name of the field you want to update, and newValue with the new value you want to set the field too. You can also update multiple records at once by using a list of SObject records and calling the update method on the list:

List<SObject> records = [SELECT Id FROM SObject WHERE Condition];

for(SObject record: records) {

    record.fieldName = newValue;

}

update records;

Additionally, you can also use the Database. update(records, false); method, which allows you to perform a DML operation on a list of sObject records.

How do you handle errors and exceptions in Apex?

Handling errors and exceptions in Apex can be done in several ways:

  1. Try-Catch blocks: Use try-catch blocks to catch and handle specific exceptions. The try block contains the code that may throw an exception, and the catch block contains the code to handle the exception.
  2. Exception classes: Use the built-in Apex exception classes, such as DmlException, QueryException, and LimitException, to handle specific types of exceptions.
  3. AddError method: Use the addError method to add an error message to a specific field or to the entire record. This method can be used to display an error message to the user and prevent the record from being saved.
  4. ApexPages.addMessage method: Use the ApexPages.addMessage method to add a message to the page, such as a warning or informational message.
  5. Finally, it’s important to have test coverage for your code to ensure that your exception-handling code is working as expected.
  6. Logging: Use the built-in Apex logging methods, such as the system. debug, to log errors and exceptions. This can be useful for debugging and troubleshooting.

It’s important to handle errors and exceptions in Apex to ensure that your code runs smoothly and that users are not presented with unexpected error messages. It’s also important to handle exceptions in a way that doesn’t compromise data integrity.

Basic Interview Questions

1. What do you understand by Field-To-Field Filters?

Filtering a report with field-to-field filters compares the values of two separate report fields. Cases amended after the closing date, for example, can be found by filtering on cases having a last modified date after the closure date.

2. Name different type of field types in Field-to-field filters?

Field-to-field filters only support these field types:

  • Firstly, numeric
  • Secondly, date
  • Lastly, DateTime

3. How many field-to-field filters does report support?

Each report supports up to 4 field-to-field filters.

4. Field-to-field filters are unavailable in what report types?

Field-to-field filters are unavailable in report types that:

  • Reference an external object
  • Have a with or without the relationship between objects

5. What are the limitations of Field-to-field filters?

  • Firstly, Field-to-field filters only compare fields of the same data type.
  • Secondly, Joined reports don’t support field-to-field filters.
  • Thirdly, Historical tracking reports support field-to-field filters, but the filter must be based on a history field.
  • Lastly, Field-to-field filters must compare two different fields.

6. What do you understand by Imperative programming?

  • Traditional or code-oriented programming, also referred to as imperative programming, involves using specific coding languages such as C++, Java, C#, etc. to instruct a computer on performing a specific task.
  • This developer will build the application step by step using blocks of code, usually in a terminal window or some other highly specialized development environment.

7. What do you understand by Declarative programming?

  • Declarative programming refers to the type of user-friendly solutions, such as clicking or dragging and dropping, that enable individuals with no programming expertise to construct an application.
  • Moreover, the blocks of code are prewritten and packaged into components that you can just select as needed.

8. What do you understand by Localization?

The process of adapting the product to a particular language, culture, and desired local look and feel. Ensure your content and user interface text are easily localizable and is grammatically correct.

9. What is the use of Translation?

You may use this information type to work with translations for a variety of supported languages. The Translation Workbench has the ability to translate component labels.

10. What do you understand by sharing?

Giving a person or group of users access to conduct a set of actions on a record or collection of records is known as sharing. Furthermore, sharing permissions may be issued programmatically or using the Salesforce user interface and Lightning Platform.

11. What are the different types of sharing?

Salesforce has the following types of sharing:

  • Firstly, Managed Sharing
  • Secondly, user Managed Sharing, also known as Manual Sharing
  • Lastly, Apex Managed Sharing

12.What is Trigger?

  • The trigger is a code segment that is run prior to or following the insertion and modification of a record.
  • One can trigger across the object and related to that object.
  • Lastly, We can use 20 DML operations in one trigger.

13. What are Custom settings?

Custom settings can be compared to custom objects. By creating custom data sets, developers can link custom data to an organization, profile, or individual. Additionally, all custom setting data can be easily accessed from the application cache, eliminating the need for multiple database requests. This data can then be utilized in formula fields, validation rules, flows, Apex code, and the SOAP API.

14. Could you name the different types of Custom settings?

There are two types of custom settings:

  • Firstly, List custom settings
  • Secondly, Hierarchy Custom Settings

15. Define List Custom Settings?

A custom setting is a feature that offers a reusable collection of fixed data that can be shared throughout your organization. Examples of list data include two-letter state codes, international call prefixes, and product codes. The data is stored in cache, making access fast and economical, so there is no need to perform SOQL searches which are subject to governor limits.

16. Define Hierarchy Custom Settings?

A tailored configuration equipped with integrated hierarchical reasoning that provides the ability to personalize settings for specific profiles or users. The hierarchy reasoning examines the organization, profile, and user settings for the active user and returns the most precise or lowest value. Additionally, the hierarchy settings for an organization are superseded by the profile settings, which are then overridden by the user settings.

17. What is the use of Metadata API?

Metadata API is used to deploy changes programmatically. You can retrieve, deploy, create, update, and delete customization information for your org, such as Experience Cloud sites, custom object definitions, and page layouts. Moreover, using Metadata API is ideal when the changes are complex or when you need a more rigorous change management process and an audit process (or version control system) to manage multiple workstreams.

18. What are Custom Metadata Types?

Custom metadata is application metadata that can be customized, deployed, packaged, and upgraded. To begin, you must first construct a custom metadata type that defines the application metadata’s format. Then you create reusable software that decides behavior based on type-specific metadata.

19. Where can one use Custom Metadata types?

Custom metadata types can be used in the following areas:

  • Custom metadata types can be used to store information that can be referenced in your Apex code, Visualforce pages, or formula fields.
  • Custom metadata types can be used as an alternative to custom settings, which are also used to store custom configuration data in your Salesforce org.
  • Custom metadata types can be used to store data for managed packages. Managed packages can access the custom metadata type data in the same way that they access custom setting data.
  • Custom metadata types can be used to store information that can be accessed by multiple Salesforce orgs.
  • Custom metadata types can be used to store data that is used to control the behavior of certain Sales

20. Give some best Practices for Designing Bulk Programs?

  • Firstly, minimize the number of data manipulation language (DML) operations by adding records to collections and performing DML operations against these collections.
  • Secondly, minimize the number of SOQL statements by preprocessing records and generating sets, which can be placed in a single SOQL statement used with the IN clause.

21. What are Exceptions in Apex?

Exceptions are used to note errors and other events that disrupt the normal flow of code execution.

22. What are the advantages of using Exceptions?

Exceptions have the advantage of making mistake management easier. Exceptions bubble up as many levels as necessary from the called method to the caller, until a catch statement is discovered to address the issue. Moreover, this bubbling up relieves you from writing error handling code in each of your methods. Also, by using final statements, you have one place to recover from exceptions, like resetting variables and deleting data.

23. What happens when an Exception Occurs?

When an exception occurs, code execution halts. Any DML operations that were processed before the exception are rolled back and aren’t committed to the database. Exceptions get logged in debug logs. For unhandled exceptions, the code doesn’t catch, Salesforce sends an email that includes the exception information. The end-user sees an error message in the Salesforce user interface.

24. Expand SQOL?

SQOL stands for Salesforce Object Query Language.

25. When is SQOL used?

  • SQOL is used in organizational performance evaluations.
  • SQOL is applied in measuring employee job satisfaction.
  • SQOL is utilized in determining company culture.
  • SQOL is employed in assessing overall work-life balance.
  • SQOL is implemented in gauging employee engagement levels.

26. Define Dynamic SQOL?

Dynamic SOQL refers to the generation of a SOQL string at runtime using Apex code. This results in more versatile applications as it allows for the creation of searches based on inputs from users or updating of records with changing field names.

27. Define Dynamic SOSL?

The term “dynamic SOSL” refers to the production of an SOSL string with Apex code during runtime. It also allows you to design more adaptable apps. You may, for example, establish a search based on a user’s input or edit records with different field names.

28. What is SOSL injection?

SOSL injection is a security vulnerability where a malicious user is able to execute unintended database methods in your application by injecting SOSL statements into your code. This can happen in Apex code if your application allows for user input to create dynamic SOSL statements and does not properly validate and sanitize the input.

29. Define an event?

An event refers to anything that happens in Salesforce, including user clicks, record state changes, and taking measurements of various values. Events are immutable and timestamped.

30. What are Component Events?

A component event is triggered by a component instance. A component event can be handled by either the component that fired it or a component in the containment hierarchy that receives it.

31. What are Application events?

The publish-subscribe approach is used for application events. An application event is triggered by a component instance. Furthermore, any components that offer an event handler are alerted.

32. What are five main components of Platform events?

  • Firstly, the pipe
  • Secondly, a window of time
  • Thirdly, the events themselves
  • Fourthly, publishers
  • Lastly, consumers.  

33. What are Apex Unit Tests?

Apex facilitates the creation and execution of unit tests to ensure the development of strong and error-free code. These unit tests are class methods that assess the proper functioning of a specific code segment. They do not require any inputs, do not persist data in the database, and do not trigger any email transmissions.

34. What do understand by Change sets?

A change set represents a set of customizations in your org or metadata component that you can deploy to a connected org..

35. What are the various methods of storing files, images, and documents? Can you enumerate them?

On Salesforce.com we can store files, images, and documents in 5 types they are.

  • Firstly, Attachments.
  • Secondly, Documents.
  • Thirdly, Google drive.
  • Fourthly, Libraries.
  • Lastly, Chatter Files.

36. Define Login Event?

A solitary occurrence of a user accessing an organization is referred to as a login event. These events bear resemblance to the login history recorded in Salesforce. The addition of HTTP header information enhances the versatility of login events.

37. What is Workflow?

A workflow is a system in which specific actions are triggered automatically based on pre-defined evaluation and rule criteria. It can be applied to multiple objects and does not allow for any data manipulation language (DML) operations.

38. What types of components can be added to a change set?

Some of them are as follow:

  • Action
  • Action Link Group Template
  • Allowed Sites
  • Allow URL for Redirects
  • Call Center
  • Campaign Influence Model
  • Channel Menu Deployment
  • Chatter Extension
  • Dashboard
  • Data Service
  • Document

39. What are the different types of Sharing Rules in Salesforce?

  • Firstly, the Account sharing Rule.
  • Secondly, Contact Sharing Rule.
  • Thirdly, Case Sharing Rule.
  • Fourthly, the Opportunity sharing Rule.
  • Fifthly, Lead Sharing Rule.
  • Lastly, Custom Object sharing Rule.

40. Expand CRM?

CRM stands for Customer Relationship Management.

Salesforce Platform Developer II Practice test
Menu