0

I needed a custom popup for creating and editing a record. To achieve this I have created a LWC which will create and edit the record.

I had wrapped this component with an aura component. and overridden the New and Edit buttons with this component.

Now the create works fine but for edit I needed the recordId from the object context.I have followed the below documentation but its not working as expected.

https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.use_record_context

But when the user clicks edit from the list view as well as the edit button in record detail page the custom component opens but the record id is not populated automatically as it was explained in the documentation.

Can someone help me find my way around this?

Thanks

4
  • Please could you provide more detail, including snippets of code? There are aspects you have not explained, such as what type of actions you overrode. I am guessing that you are overriding page-level actions, but you could have overridden a global action (for new at least) or list action(s), and each of these will behave differently. The link you cite applies to top-level components inserted in a Lightning Record Page. – Phil W Sep 27 '19 at 7:13
  • For the action, did you try doing something like this? I recommend you edit your question if you want someone to be able to answer it. – Phil W Sep 27 '19 at 7:14
  • @PhilW I did mentioned i was trying to override new and edit. I have now highlighted them for better readability – Umamaheswaran Sep 27 '19 at 7:20
  • 1
    Hi, yes but actions can appear in all sorts of different contexts where access to record ID can vary. Anyway, I see it was just an issue with not passing the value from your top-level component (Aura) into the child (LWC). – Phil W Sep 27 '19 at 7:23
0

I have solved this issue by passing the recordId from aura component.

<aura:component
                implements="lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
    <c:adminSaveProgramTemplate recordId="{!v.recordId}"></c:adminSaveProgramTemplate>
</aura: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.