You need to sign in to do that
Don't have an account?
Victor Mora 6
New button override does not pre-populate the master detail detail field with the parent object record!
I created a visualforce page to override the new button of custom object called "Employment History" which is a child object to the standard contact object. I did this in order for the record name (in this case its called employment history name" will be pre-populated with the value "Default Value - IGNORE" so that I could update it with some concatenated field values on the same record using a workflow field update.
I was able to override the new button with a custom visualforce page in order for the record name to be pre-populated but this prevented the master-detail field to the contact object called "Student" from being populated with the parent record when I went to click the new button on the related list located on the contact detail page.
Here is the code I used to override the new button
<apex:page standardController="Employment_History__c" action="{!URLFOR($Action.Employment_History__c.New, null, ['Name'='Default Value - IGNORE'], true)}" />
I would really appreciate it if someone could explain to me how I can set the master detail field on the employment history object equal to the contact ID of the parent contact record.
I was able to override the new button with a custom visualforce page in order for the record name to be pre-populated but this prevented the master-detail field to the contact object called "Student" from being populated with the parent record when I went to click the new button on the related list located on the contact detail page.
Here is the code I used to override the new button
<apex:page standardController="Employment_History__c" action="{!URLFOR($Action.Employment_History__c.New, null, ['Name'='Default Value - IGNORE'], true)}" />
I would really appreciate it if someone could explain to me how I can set the master detail field on the employment history object equal to the contact ID of the parent contact record.
can you please elaborate what are you trying to acheive here?
or you wnat to populate just Some field in the child record whenever user clicks on NEW button in related list?
in other workds the need is (what i understood)
- user clicks on New button in Related list of Child object.
- a new window should be opened up
- Pre-populate the Parent Object i.e parent contact record
- any generic Name should be autopopulated as well, coz Name field is (might be) required in the object.
- Record is saved
- Workflow is triggered
Solution-You can acheive this using URL hacking, however this may not work in SF1 or lightning if at all you are using those things. If you are using the Salesforce 1 or lightning than approach would be diiferent.
Here is the solution, assuming SF1 and lightning is not being used
1. Get the first three letters of CHILD OBJECT (just got to any record and lookput at URL)
2. see the image below and create a custom button like this.
REPLACE "PUT_FIRST_THREE_LETTERS_OF_CHILD_OBJECT_GRABBED_AT_STEP1" text in the image by vlaue obtained in #1
.
3. Save the button
4. Edit parent Object Layout
5. Add button in related list.
Save and try, this should work!