Salesforce PDII Question Answer
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?
Salesforce PDII Summary
- Vendor: Salesforce
- Product: PDII
- Update on: Dec 26, 2025
- Questions: 161

