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
Bola Ola 24Bola Ola 24 

is it possible to enter a parent and child information at the same time before saving the parent and then saving the children records

Good Day SFDC Developers, I am a salesforce admin so a novice when it comes to development.
I have 2 objects A and B, A is the parent of B (master detail relationship). My users want a way of forcing the user to always create at least one child record B, whenever a parent record A is created. Meaning do not allow creation of A without a creation of at one record of B. 
How can this be implemented? Suggestions Please.
Is it possible to use LWC and/or visualforce to do this? Can we have a page for the parent record, users enter the fields for the parent record and then by clicking a "Next" button direct users to enter children record(s) for B object and on clicking save from the children B page, it saves parent A first and then saves the children by adding the id from the parent to the children records?
SwethaSwetha (Salesforce Developers) 
HI Bola,
You need to write a trigger to accomplish your requirement

Please see with https://salesforce.stackexchange.com/questions/75810/apex-trigger-create-a-child-record-when-a-new-parent-record-is-created for the code
trigger CreateChild on Parent__c(after insert) {
  List < Child__c > Childs = new List < Child__c > ();
  for (Parent__c a: trigger.new) {
    Child__c Child = new Child__c();
    Child.Parent__c = a.id;
    Child.Name = 'Child 1';
    Childs.add(Child);
  }
  for (Parent__c a: trigger.new) {
    Child__c Child = new Child__c();
    Child.Parent__c = a.id;
    Child.Name = 'Child 2';
    Childs.add(Child);
  }
  insert Childs;
}
You need to customize this according to your requirement.

Related: https://developer.salesforce.com/forums/?id=9060G000000Xca8QAC

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you