1

Let's say I have two objects, Object A and Object B.

I have a related list on Object A's page layout, which can be used to create B objects.

The problem is, Object B has many "system" fields (like external IDs etc), which will be filled in later on, and so should be "hidden".

Our previous developer created an aura component to handle this on the Object B creation page. This component contains only the fields relevant to the user.

When clicking "new" from the related list, the standard Salesforce "new" screen is shown.

Is there a way to show the aura component (or to create a new screen) when initiating a new object from the related list on object A's page?

Should I even go down this aura route? Is there a simpler way to create a "custom new object" screen from the related list?

Thanks, and apologies if I am misunderstanding or using the incorrect terminology, I'm new to Salesforce development.

1

There are actually a lot of possibilities to achieve what you want.

First one is to override your New button for Object B.

You need to add to your aura component this interface:

  implements="lightning:actionOverride"

probably with some other ones like

force:hasRecordId

Next you can go to Object B Object Manager -> Buttons, Links, and Actions and select Edit for New action. Then set lighting override like in example below:

Contact Example

Now when you try to create Object B from Related List your component will be opened. Downside: All New actions (so for example from List View) will be replaced with your aura component.

Another idea is to create custom button for Object B. Personally I've created button with URL to Lightning App page with component as it was the easiest solution. Custom Link

URLPage is a link to a page created via Lightning App Builder (you need to create new App Page there)

After that on Object A you can edit related list for Object B and add button with a link which we just created

Related List button

Your component on that page would need to be an aura:application component actually.

You can also create Visualforce page instead of a link and use it instead URL for example, or just remove New button at all from Related List and create Quick Action for Object A which will use Lightning Component for Object B creation (personally I love quick actions so it would be my choice)

1
  • Thanks! I'll start to implement this today! :)
    – Jessica
    Jun 17 at 9:53

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.