PDII Web TestEngine demo

Exit VCEDump PDII Salesforce Certified Platform Developer II (Plat-Dev-301)
Question 48 of 67
0% complete
Q48 Single choice

MyOpportunities.js

import { LightningElement, api, wire } from 'lwc';
import getOpportunities from '@salesforce/apex/OpportunityController.findMyOpportunities';

export default class MyOpportunities extends LightningElement {
@api userId;

@wire(getOpportunities, { oppOwner: '$userId' })
opportunities;
}

OpportunityController.cls
public with sharing class OpportunityController {

@AuraEnabled
public static List<Opportunity> findMyOpportunities(Id oppOwner) {
return [
SELECT Id, Name, StageName, Amount
FROM Opportunity
WHERE OwnerId = :oppOwner
];
}
}

A developer is experiencing issues with a Lightning web component. The component must surface information about Opportunities owned by the currently logged-in user. When the component is rendered, the following message is displayed:
"Error retrieving data".

Which action must be completed in the Apex method to make it wireable?

Sign in to mark questions

Sign in to save marked questions and return to this demo.

Sign in