+ Start a Discussion

Parent Field Make Mandatory

How to make parent field mandatory before create child record..
Ahmad J. KoubeissyAhmad J. Koubeissy
make it required on the profile or the object layout.

Kindly mark as best answer if this solves your question
Hay ahmad Requirement is i have two object parent and child .i have created parent record and missed some field.Need to cross check parent missed field first before child record creation .I mean when i am going to create child record it will be display plz fill missed field...
I would take the below approach,

1) First I would find-out which are the fields are always needed to be filled before that parent can have any child record. If I find any of them then I will make them required using page-layout or even universally required (by going to the object --> Field --> make always required)

2) Now if i find there are some fields which are only requied when there is certain type of child record exists then I would have child records categorized by somesort of field like Child_Record_Category__c and it can be A, or B or C.

3) Now, let's say parent record has 10 field (e.g., aa__c, bb__c, cc__c, dd__c, ee__c, ff__c, gg__c, .. etc.) in total. I would make 10 formula field on child object which would fetch the exact same value of parent field.
e.g., aa_From_Parent__c, bb_From_Parent__c, cc_From_Parent__c etc... up to all 10.

4) Now, If I know that whenever there is a TYPE A child record (means Child_Record_Category__c = A ) then its parent should have aa__c, and cc__c then I would make a validation that says

Child_Record_Category__c = "A",

Error: Whenever child record has catagory of "A" then aa_From_Parent__c and cc_From_Parent__c should be provided.

Do the samething for all categories.

This is what the big picture is:

You are creating a bunch of formula field on child record for fetching several important values of parent fields.
Now you are categorizing the child object by category of A or B or C etc.. and then based on the category, you are demending values should be populated in several field.

It's like if parent record is created with few fields let's say 3 out of 10.
Now, you are creating child record for that parent and when you click save button, it will throw an error that some of the formula are are blank. Why? because there is nothing to fetch from parent.
Now, if you go back to the parent and full-fill some of the fields then formula of child record would fetch those recently provided field values and now you are able to save the record.

Hope this helps and mark it best if its answers your question!
Hay @ Govind I have tested as for your approach.but requirement is Parent record has been created with some missed field.When I am creating child means click New button for child record creation at that time i need validation like please check parent field
I am not sure if its possible that way though... Validations, Processes, Triggers all the good stuff gets fired when records are subject to save.

By above approach, you are able to create a child record but not save it since some of the parent fields are missing (or in other words some of the formula fields on child didn't get calculated because it was never get pulled off from parent).

There is one more approach I can think of which is to get the fields auto populated. You know when you create an opportunity from Account related-list how opportunity gets populated with pre assigned name in Account Name field? I am thinking something similar for you which is to have your child record openup (get born) with pre-defined values but even in that case you are gonna have to save the record in order for validation to get fired.
In my opinion above approach can only be the only one that I can think of..;)  But I am really enthusuastic to know if there is any other..
Thank You and good question BTW!