You need to sign in to do that
Don't have an account?
Raksha Narayan
Call wire method from another method in LWC
I have a button which is a quick action and I am calling a LWC and the logic is handled in the invoke method. Below is the LWC structure.
@wire(getRecord)
.
.
@wire(getRelatedListRecords)
.
.
@api invoke(){
..
}
I want to call @wire(getRelatedListRecords) in the invoke method or I want to reload the LWC component on clicking the button.
Is this possible?
@wire(getRecord)
.
.
@wire(getRelatedListRecords)
.
.
@api invoke(){
..
}
I want to call @wire(getRelatedListRecords) in the invoke method or I want to reload the LWC component on clicking the button.
Is this possible?
Salesforce Doc:
To refresh Apex data provisioned via an Apex @wire, call refreshApex(). The function provisions the data using the configuration bound to the @wire and updates the cache.
NOTE The parameter you refresh with refreshApex() must be an object that was previously emitted by an Apex @wire.The parameter you refresh with refreshApex() must be an object that was previously emitted by an Apex @wire.
more details here https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_result_caching
please try and let us know if works. Thanks.