Plat-Dev-301 practice question 6 of 10
Refer to the code below: Lightning Web Component JS file JavaScript import {LightningElement} from 'lwc'; import serverEcho from…
Choose your answer, then check it against the explanation.
Refer to the code below:
Lightning Web Component JS file
JavaScript
import {LightningElement} from 'lwc';
import serverEcho from '@salesforce/apex/SimpleServerSideController.serverEcho';
export default class Helloworld extends LightningElement {
firstName = 'world';
handleClick() {
serverEcho({
firstName: this.firstName
})
.then((result) => {
alert('From server: ' + result);
})
.catch((error) => {
console.error(error);
});
}
}
Apex Controller
Java
public with sharing class SimpleServerSideController {
@AuraEnabled
public static String serverEcho(sObject firstName) {
String firstNameStr = (String)firstName.get('firstName');
return ('Hello from the server, ' + firstNameStr);
}
}
Given the code above, which two changes need to be made in the Apex Controller for the code to
work?
Question 6 of 10
Keep practicing
Take the free Plat-Dev-301 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-301 practice questions
- Question 1Which use case can be performed only by using asynchronous Apex?
- Question 2The Account object has a field, Audit_Code__c, that is used to specify what type of audit…
- Question 3How should a developer verify that a specific Account record is being tested in a test cl…
- Question 4There is an Apex controller and a Visualforce page in an org that displays records with a…
- Question 5A developer created and tested a Visualforce page in their developer sandbox, but now rec…
- Question 7A developer is developing a reusable Aura component that will reside on an sObject Lightn…
