Apex Refresh data-table is not working on LWC. Can anyone please help me what I'm missing below.


<div class="slds-p-top_x-large">
                            <lightning-datatable key-field="Id" data={data} columns={columns}
                                draft-values={draftValues} hide-checkbox-column="true"

 <div class="slds-size_2-of-2">
                                        <lightning-button type="submit" variant="brand" value="AddParent"
                                            name="AddParent" label="Save" onclick={handleonClickParent}>


import { refreshApex } from "@salesforce/apex";

@track error;
@track data;

@wire(getParentdetails, { enrollmentName: "a082w000000YUH5AAO" })

getContacts(response) {
console.log("data -->" + response);
this.wiredDataRefresh = response;
const data = response.data;
const error = response.error;
if (data) {
  this.data = data;
} else if (error) {
  this.error = error;

 handleonClickParent() {
 return refreshApex(this.wiredDataRefresh);

refreshData() {
return refreshApex(this.wiredDataRefresh);


@AuraEnabled (cacheable = true)
public static List<Contact> getParentdetails(Id enrollmentName) {
     return   [select  Id, Firstname, LastName, Email, Phone, Student_Relation__c
              from Contact WHERE Enrollment_Name__c=:enrollmentName];
  • 2
    enrollmentName is expecting an ID but in your sample you're putting "man" Mar 2, 2020 at 13:34
  • 1
    You define refreshData() but doesn't look like you ever call it elsewhere in your code Mar 2, 2020 at 13:35
  • @BrianMiller I have save button in my form, onclick of save button handleonClickParent is called. Edited my questions Mar 2, 2020 at 13:46
  • Also include that save button code. Could be something simple like the names not matching because of being case sensitive, etc Mar 2, 2020 at 14:02
  • Added the save button code Mar 2, 2020 at 14:10

1 Answer 1


wiredDataRefresh is not declared in the js file as per your code snip. Could you see if that is the case?

Note: I don't have enough reputation to comment hence writing my comment as an answer. Sorry for this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .