function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mak OneMak One 

In Standard Page Layout I want to create 1 more record of related Object.

Suppose I have Object Parent1 and Child1. Child1 is having lookup to Parent1.
Parent1 is having Standard Page Layout (Not Visualforce). Now, I want that whenever the user click on Save, with creating new Record of Parent1 it should also create new Record for Child1.

By default it will create record of Parent1 only. But with Parent1 I also want 1 record of Child1 to be created.

I don't want to convert whole Page to Visualforce Page.

What will be the best way to achieve this?
Is Trigger is the best way?
What are the other ways?

For NEW button we can goto Visualforce page which can forward you to standard page but for SAVE this thing we cannot do? Like when we click on Save it will save record and goto one Visualforce Page which will do it's processing then return back to Created Record or any default Page.

We cannot provide functionality in Standard Page Layout only? By Declarative approach or anything?
Best Answer chosen by Mak One
Tony TannousTony Tannous
Hello Mak,

Yes the AfterInsert Trigger on the parent object is the best solution, in the after insert trigger, you have the Parent Id so you can create the children record.



Good Luck

All Answers

Mak OneMak One
Can we give fields of Child1 as hidden fields in Page Layout and pass Query parameters with values to be provided to those fields? Will it create record of that object(Child1) also then?
Tony TannousTony Tannous
Hello Mak,

Yes the AfterInsert Trigger on the parent object is the best solution, in the after insert trigger, you have the Parent Id so you can create the children record.



Good Luck
This was selected as the best answer