Skip to main content
I created a Custom Object named "Contract Summary", which automatically creates the required field "Contract Sumary Name". I created a lookup field to Opportunities which allows me to have "Contact Summary" as a related list on Opportunities. I made the tab for "Contract Summary" hidden so the only way to create a Contract Summary record is through an Opportunity.

 

On the Opportunity there is a field named "Project ID #", I would like to have the "Contract Summary Name" field auto populate with the value from the "Project ID #".
3 answers
  1. Jul 28, 2016, 11:59 PM
    Hi Julie,

     

    For starters, this wouldn't be a validation rule.  A validation rule checks for criteria and provides an error message if the criteria is met. 

     

    You probably meet a workflow rule, which will allow you to do field updates or take actions based on criteria.  However, even this wouldn't be the approach that you would want to take.  The solution you are looking for is a custom button to create the Contract Summary record.  When you use a custom button, you can set field values when navigating from a current record to the creation page of a new record.

     

    Here are the steps:

     

    1)  Gather the required information before you start the process of creating a new button.  You'll need the object url reference by going to the object tab:Hi Julie, For starters, this wouldn't be a validation rule. A validation rule checks for criteria and provides an error message if the criteria is met.

     

    And the id of the field that you are going to map the value to.  You can get this by going to your setup menu and then going to the field.  So you'd navigate to Setup>Create>Object>Contract Summary and then click on the Contract Summary Name and look in the URL to get the ID.  It will be a 15 digit id right before the retURL.  You'll also need to do the same thing to get the Record Type Id if you are using record types for Contract Summary.  Lastly, you'll need to get the id for the Lookup field to the Opportunity.

     

    2)  Create the button.  Create the button on the Contract Summary object, click new button and then have it in this format:

     

    User-added image

     

    3)  Fill in the contents of the button.  The button will have the format of:

     

    /500/e?

     

    CFxxxxxxxxxxxxxxx = 

     

    &CFxxxxxxxxxxxxx = {!Opportunity.Name}

     

    &CFxxxxxxxxxxxxx _lkid = {!Opportunity.Id}

     

    &RecordType=

     

    &retURL=

     

    This is only if this is the Case object.  The /500 would be replaced with the 3 digit Object id when you click on the Contract Summary tab.  The second line is the Custom Field and the id of the Contract Summary Name.  The third and fourth line will be for the lookup field to the Opportunity.  The ID should be the same, the only difference is that in one line you add the "_lkid" (lookup ID) and in the other you are putting the name of the record.  You can ignore the fifth line if you don't have record types, and the last line is the return url if you save/cancel.  All of these lines have an "equals" sign where you will put the value for the field when you press the button.  So it should looks something like this:

     

    /500/e?

     

    CFxxxxxxxxxxxxxxx = {!Opportunity.Project_Name__c}

     

    &CFxxxxxxxxxxxxx = {!Opportunity.Name}

     

    &CFxxxxxxxxxxxxx _lkid = {!Opportunity.Id}

     

    &RecordType= xxxxxxxxx

     

    &retURL={!Opportunity.Id}

     

    You can use the formula builder to get the merge fields that you need.  The return URL will we where you are navigated to when returning, in this case the Opportunity id where the button was clicked from.

     

    4)  Add the button to the page layout.  You'll need to go to the Opportunity page layout and then scroll down to the related lists to edit and add your new button.

     

    After that you should be good to go.  Here is a link explaining URL Hacking, which is what you want to do http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html  (http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html)
0/9000