exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 343 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 343
Topic #: 1
[All Certified Platform Developer II Questions]

A developer is creating a Lightning web component that displays a list of records in a lightning-datatable. After saving a new record to the database, the list is not updating.



What should the developer change in the code above for this to happen?

  • A. Add the @track decorator to the data variable.
  • B. Create a new variable to store the result and annotate it with @track.
  • C. Create a variable to store the result and call refreshApex().
  • D. Call refreshApex() on this.data.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
dasabhisek404
6 months ago
Selected Answer: C
C is correct, you have to send whole result into refreshApex to get latest data.
upvoted 3 times
...
MarkusT
7 months ago
C is correct. The "data" variable only stores the "data" part of "result". However, following the same link everyone posted here, salesforce docs clearly say that the wired function should use the entire "result" parameter in a wired function. Hence, we need to store "result" in a new variable and then call refreshApex on it.
upvoted 2 times
...
Yas010101
11 months, 3 weeks ago
Selected Answer: D
https://developer.salesforce.com/docs/platform/lwc/guide/apex-result-caching.html
upvoted 1 times
...
BrucePark
1 year, 4 months ago
Selected Answer: D
Isn't it D? Because records is a wire function and assigns the result to this.data. So, this.data is the variable currently holding the displayed data.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago