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
Kumar GKumar G 

How to restrict the duplicate child record creation

Opportunity(Standard Object) and Profile(Custom Object) having master detail relationship , 

Profile object is having an picklist field called Year with the values like 2020,2021,2022... 
         
  Opportunity Name     Profile : Year
Allow : OPP1                :2020
            OPP1               :2021
Diffrent years should associated with the same Opportunity.

Don't Allow : OPP1      :2020
                     OPP1      :2020
Same year should not associated to the same Opportunity.

Need to through an validation while saving the duplicate Profile record with the same year to the same opportunity.

Please let me know can we achieve this throgh custom LWC ?

Kindly suggest me wit hyour solutions.Thanks in advance.

 
ShirishaShirisha (Salesforce Developers) 
Hi Kumar,

Greetings!

You need to use the custom controller to query the Object to see,if there is any record with the value of 2020 if it returns null then they can use the value.

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri