1

I have a customer detail page in which i have some related lists and notes related list. I need to automatically populate name of the customer from the detail page when user clicks New button on related list on notes and other related list pages.

What is the best way to accomplish this?

2
  • It is standard functionality of Sf, if the related lists are child objects(or even lookup objects) they will have a lookup field, which would be populated with that customer name from the detail page automatically.
    – Mahmood
    Jun 22, 2017 at 22:00
  • oh by name i mean a custom field not a standard field.
    – user43192
    Jun 22, 2017 at 22:24

2 Answers 2

0

At the moment there is no standard way to override the "new" button in a related list. Your best bet would be to develop a small visualforce or lightning component to display a custom related list and also do whatever action you wish when you click the button.

Nonetheless, when you add a new child object, the parent relation is immediately filled in, which I don't know if it answers your question.

0

In order to achieve this you need to follow the next steps

  1. Create a new Custom List Button. This button will replace the standard New button

  2. The button will be of URL type and you will have to do a bit of URL hacking(check it here) in order to auto-complete the name field with the value of account name. Something like

    /lightning/o/Contact/new?defaultFieldValues=OwnerId={!Account.OwnerId},AccountId={!Account.Id}
    
  3. Edit the page layout of the parent object, and go down to the related list of the child object. Click on the settings wrench and there you will have the option to add your newly created custom button to the related list and remove the standard buttons. Save the layout and test your changes

You must log in to answer this question.

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