+ Start a Discussion
dfpittdfpitt 

Defaults when creating a new record

I have 3 custom objects: A, B and C.

 

B: Has a master-detail relationship with A

C: Has a master detail relationship with B and a lookup relationship with A

 

If I am viewing a record of a custom object type B and I create from there a NEW record of type C, it automatically fills in the field that relates C to B, but the field that relates C to A is empty. Given that B is connected to a specific A, i would like that A to be related by default to C.

 

How can I do this? Does this need to be a new custom button?

Best Answer chosen by Admin (Salesforce Developers) 
dfpittdfpitt

I created a custom button that:

 - Calls a method in an APEX class that creates the records with the defaults

 - Sends the browser to that record so that the user can modify the relevant fields

 

All Answers

VJSFDCVJSFDC

Hi,

 

You will have to Pick the Value of A field on C object manualy and then all the fields related to A will be populated in C object.

It will not be auto populated as its one to one relationship.

 

Thanks.

 

dfpittdfpitt

Thanks,

 

is there no way to fill it out automatically?

VJSFDCVJSFDC

hi,

 

You can try creating a formula Field, where you can traverse through the relationship from C->B-> A to pull the the field need from A object on to C objects.

 

 

dfpittdfpitt

Thats not a bad idea, but the fields that I want to have defaults on are lookup and master-detail relationship fields. Is there any way to default those?

dfpittdfpitt

I created a custom button that:

 - Calls a method in an APEX class that creates the records with the defaults

 - Sends the browser to that record so that the user can modify the relevant fields

 

This was selected as the best answer