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
chaithaly gowdachaithaly gowda 

How to make related object record mandatory before fully saving the parent record

Hello,

I have this scenario where I have a child object called 'reserve__c'  for an 'opportunity' as a parent.

when a new opportunity is created ,I want to make sure user creates reserve__c record as well.
Can someone please help me with the solution! 
Nihar ANihar A
Hi Chaithaly,
You can write some logic in afterinsert context of Opportuinty tirgger to create a new Reservce__c record with everytime an opportunity is created and then you users can go in a fill the data on that reservce record thats created. If you want users to create populate an opportunity and also have the option to populate reserve object data before inserting then you might have to do some standard buttton overrides on the New button of Opportunity. Hope this helps.
Thanks,
Nihar.
chaithaly gowdachaithaly gowda
Thanks Nihar, but I  have requirement like you have mentioned in second approach.,Could you please share any code to impelment this functionality through  vf page
Tim Wilson 27Tim Wilson 27
Hi Nihar! Thank you so much for your recommendation, a few days ago I just had a similar issue with my project https://topcasinoplanet.com/, and thanks to you I was able to fix it.