0

I'm trying to update the record using the recordId passed from aura quick action, then lwc component will update the record. However when I try the following:

  • called the connectedCallback but the recordId is null
  • used wire method to call the apex method(not cacheable=true) but cannot be called when not cacheable true.

There is no UI. Once the button is clicked the record will automatically update.

I can do this with aura, if there is no workaroun I will use the aura component instead. TIA.

  • 3
    please add the minimal required code to identify your issue. – sanket kumar Oct 9 '20 at 5:10
0

I think you should use getters and setters from @api annotation. Then you can wrap value assignment with some additional logic.

0

This is a working example-

Aura Component

<aura:component implements="force:lightningQuickAction,force:hasRecordId">
    <c:quickActionComponent recordId="{!v.recordId}"/>
</aura:component>   

There's no controller code

LWC code

import { LightningElement, api } from 'lwc';

export default class QuickActionComponent extends LightningElement {

    @api
    recordId;

    connectedCallback(){
        console.log(this.recordId);
    }
}

Notice that the LWC component attribute is recordId because its inside an Aura component and not record-id (if it were in another LWC component)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.