1

I have successfully overwritten the "New" and "Edit" behavior of a custom object with a lightning aura component. Everything is working fine and if the user clicks the related list new button of the parent Account, I can prepopulate the Account in the component using the AccountId of the URL. So good so far.
Unfortunately, if the user clicks the New record shortcut from the object tab, my component prepopulates the Account too. I need to distinguish if the user has clicked the related list "New" or the "New" of the Object tab. Any ideas how to achieve this?

enter image description here

2 Answers 2

1

Solution: Create a custom Quick Action "New" that will be placed on the related list on the Account object. This custom Quick Action can pass parameters into the LWC and due to this, the LWC can distinguish between a click on the custom Quick Action and the Object "New".

0

I don't know if that is possible. You should create a new action/button using Aura/LWC and disable the Create permission for the Account Object for every profile that you don't want to see the standard New button (removing the Create permission for a profile means that the users with that profile will not see the Standard New button). Then you can place the new action/button to the Related List from the page layout

3
  • Hi sfdcfox, thanks for your suggestion. If I correctly understand, I should remove the create permission for Visit & Call (and not Account). If I do so, the New functionality in the Objects Tab will disappear. However that's not what I wanted to achieve. I just wanted to identify if the user has clicked the Objects Tab "New" or the related lists "New". Commented Aug 25, 2021 at 7:50
  • Yes, Visit & Call, not Account, sorry for that. I don't think you can identify if the user clicked the Objects Tab "New" or the related lists "New", because is the same button. Creating a new custom button and taking the Create permission from the profile level will cover your requirement
    – Alex
    Commented Aug 25, 2021 at 8:07
  • Hi Alex, thanks for your comments. If I take away object permissions, I will take away the New Visits & Calls from the object tab and that will not cover my requirement. I don't want to take it away. However I think, I can create a custom quick Action "New" that can be used on the related list instead of the standard "New" action and then pass into the component that it was clicked from the related list. Thanks for your hints ... brought me to the idea. Commented Aug 25, 2021 at 11:29

You must log in to answer this question.

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