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
GrrrrrrrrrrrrrGrrrrrrrrrrrrr 

Master-Detail in Edit Mode

Hello Everyone,

   I have two custom objects tied by Master-Detail.  But in my child object, in edit mode, I cannot see the Master-Detail field (not even as a read only).  I do not want to edit the Master Detail field, I just want to be able to show the Parent field.

 Example:

     Parent Object

          Name field

          Date field

          Currency FIeld, etc.

     Child Object

            Name (Master Detail from Parent) field

            Date field

            Location field, etc.

 

When I am editing my child object, I just want to see which Parent it belongs to.  There are too many occassions where the wrong record is being updated since the user is losing track of what Parent / Child records they are really working in!!  This is very frustrating.

 

I am not opposed to VF, Apex, or Trigger workarounds, although shame on Salesforce for making that necessary.  I have tried using various formulas and field updates, but each time I am not able to access the Parent's Master-Detail field.

 

Any thoughts?

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
GrrrrrrrrrrrrrGrrrrrrrrrrrrr

Thank you for the info.  What I finally ended up doing was create a field update that (On save or on edit) populates the Child record.  After a lot of playing around I got it to work.

 

All Answers

Madhan Raja MMadhan Raja M

Hi,

 

By default the parent name will be displayed in the edit page as read-only:

 

 

You might have removed the visibility for the Parent field in the profile.

 

Madhan Raja M

GrrrrrrrrrrrrrGrrrrrrrrrrrrr

Madhan Raja M,

   Could you be more specific?  I dont have the option to check read only in my profile box.

   I am not able to make any changes in my profile section that allows what you are saying.

  Please explain to me how you make the parent field read only in edit mode.  I appreciate the help!

Madhan Raja MMadhan Raja M

If it is a Master-Detail relationship then by default the parent field will be Read-Only in edit page (you cannot manually change it to Read-Only).

 

When you create a child record can you able to see the Parent field lookup? If yes, then you have visibility to the Parent field.

 

Madhan Raja M

GrrrrrrrrrrrrrGrrrrrrrrrrrrr

I see what you are saying.  I apologize, I did not explain that very well the first time.   What I am trying to do is call on a field in the Parent record and have it display on the child record each time a child is created, or later, edited.

I have a Parent custom object with a field called "Job_Name__c".  It is a plain text field.

I have a Child custom object called "bid__c" that is tied to the parent through a Master-Detail field called "Job__c"

 

What I want to do is have a field on my Child record that displays the same value as the "Job_Name__c" field on the Parent Record when the child is in edit mode.

Parent:

  Job12345  (Name) (Auto-Number)

  Job Name:    Remodel Warehouse (Job_Name__c) (Text)

 

Children:   (1)

   Job12345 (this shows as read only in edit mode)

   Job Name Should Auto populate based on parent's Job Name "Remodel Warehouse"

   Bid Number 1

   Quote 500.00

Children:   (2)

   Job12345 (this shows as read only in edit mode)

   Job Name Should Auto populate based on parent's Job Name "Remodel Warehouse"

   Bid Number 2
   Quote 600.00

Children:   (3)

   Job12345  (this shows as read only in edit mode)

   Job Name Should Auto populate based on parent's Job Name "Remodel Warehouse"

   Bid Number 3
   Quote 550.00

Madhan Raja MMadhan Raja M

I got your scenario, you want to display the Parent's (Job__c) Job Name in to Child's (Bid__c) Job Name (Custom field) when you edit the child record.

 

1. You can create a Formula field in Bid object that points to Job's Job Name field. This field can be seen in View mode and not in Edit mode.

2. Write a Trigger in Bid object that will fetch the Job name from the associated Job's record.

 

Madhan Raja M

GrrrrrrrrrrrrrGrrrrrrrrrrrrr

Thank you for the info.  What I finally ended up doing was create a field update that (On save or on edit) populates the Child record.  After a lot of playing around I got it to work.

 

This was selected as the best answer
GrrrrrrrrrrrrrGrrrrrrrrrrrrr

Yes, that is exactly what I am trying to do!  I did a poor job of explaining it the first time.