PDI practice question 13 of 30

Universal Containers recently transitioned from Classic to Lightning Experience. One of its business processes requires certain values from the…

Full set: 201 questions
Universal Containers recently transitioned from Classic to Lightning Experience. One of its business processes requires certain values from the Opportunity object to be sent via an HTTP REST callout to its external order management system when the user presses a custom button on the Opportunity detail page. Example values are as follows: * Name *Amount * Account Which two methods should the developer implement to fulfill the business requirement? Choose 2 answers
Answer options
A: Create a custom Visualforce quick action that performs the HTTP REST callout, and use a Visualforce quick action to expose the component on the Opportunity detail page. Correct answer
B: Create a Remote Action on the Opportunity object that executes an Apex immediate action to perform the HTTP REST callout whenever the Opportunity is updated.
C: Create a Lightning component quick action that performs the HTTP REST callout, and use a Lightning Action to expose the component on the Opportunity detail page. Correct answer
D: Create an after update trigger on the Opportunity object that calls a helper method using @future (Callout=true) to perform the HTTP REST callout.
Correct Answer:
A. Create a custom Visualforce quick action that performs the HTTP REST callout, and use a Visualforce quick action to expose the component on the Opportunity detail page.; C. Create a Lightning component quick action that performs the HTTP REST callout, and use a Lightning Action to expose the component on the Opportunity detail page.
Explanation

The requirement is to initiate an HTTP REST callout when a user clicks a custom button on an Opportunity record page in Lightning Experience. Both Quick Actions using a Visualforce page and a Lightning Component are valid methods to achieve this. A Visualforce quick action (A) allows an Apex controller to be invoked, which can perform the callout. This method is supported in both Classic and Lightning Experience. A Lightning component quick action (C) is the modern, Lightning-native approach. The component's JavaScript controller calls an Apex method annotated with @AuraEnabled(cacheable=false callout=true) to perform the callout. Both solutions fulfill the core requirement of a user-initiated callout from a button.

Why Incorrect

B. "Remote Action" is not a standard Salesforce automation tool in this context. More importantly, the action is triggered on every record update, not by a specific button click as required.
D. An Apex trigger fires automatically in response to a data manipulation language (DML) event (e.g., record update), not from a user explicitly clicking a button on the user interface.

References

1. Lightning Component Quick Actions (Option C):

Lightning Web Components Developer Guide, "Configure a Component for Quick Actions". This guide explains how to expose a Lightning web component as a quick action, which appears as a button on a record page.

Apex Developer Guide, "Invoking Callouts Using Apex". This section details how Apex controllers, which can be called from Lightning components, are used to make HTTP callouts. Specifically, it notes that callouts cannot be made from methods where cacheable=true.

2. Visualforce Quick Actions (Option A):

Salesforce Help, "Create Object-Specific Quick Actions". Under the "Action Type" section, it lists "Custom Visualforce" as a valid type for an object-specific action, which can be placed on page layouts.

Visualforce Developer Guide, "Making Asynchronous Callouts". This document explains that callouts can be made from the Apex controller of a Visualforce page, which is the mechanism used by a Visualforce quick action.

3. Why Triggers are Incorrect (Option D):

Apex Developer Guide, "Triggers". The first paragraph states, "Apex triggers enable you to perform custom actions before or after events to records in Salesforce, such as insertions, updates, or deletions." This confirms triggers are tied to DML events, not UI actions.

Scroll to Top