+ Start a Discussion
NM AdminNM Admin 

Only one parent record per day, can have multiple child records for the same day.

Hello,

I have a scenario, I have a parent object 'A' with fields DateTime, User(Lookup),Address and child object 'B' with same fields.
How to restrcit user to create only one record per day? User can create multiple records for the same parent for the same day.


Welcome to youe suggestions!

Thanks,
Nilesh
NagendraNagendra (Salesforce Developers) 
Hi,

May I suggest you please check with below link from the stack exchange community with a similar discussion which might help you. Please let us know if this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
NM AdminNM Admin
Thanks Nagendra,

Any way to do this using apex only? Suppose I don't want to create a process builder.

Thanks,
Nilesh
RD@SFRD@SF
Hi All,

If you don't want to create a new process. You can do the following.

1. Create a new text field with default value as today
2. And mark this field as unique

on the parent record.

1. When the first record is created the value would be updated with today's date
2. When the second record is created the record will not get created giving the Data Uniqueness Violation

Hope it helps
RD