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
Finky9Finky9 

Trouble pre-populating fields passed to custom object

I have a help request for URL merge fields on Custom Buttons (new Salesforce SFA7 release feature).  I want to pass the standard Opportunity Name field to a field in a custom object. The field in the custom object is a Master-Detail Relationship field referencing the opportunity field called Opportunity Name.

 

I have a Custom Button (settings below) on an Opportuntity.  The button launches a Custom Object called Ticket in edit mode. The button hyperlink code here works fine:

/a03/e?retURL=%2Fa03%2Fo   This is the server agnostic URL of my Ticket object in edit mode 

However, I want to append this to pre-populate the Ticket with the opportunity name from which it was launched.  Using Firefox Web Developer extension I have determined that the field name of the Deals field on my custom Ticket object is 00n60000001uwgo.  (Through trial and error I believe that custom fields have names like this and standard fields have names like opp3.  Tell me if I’m wrong.)  I also believe the merge field name for the opportunity name is {!Opportunity.Name}.  So, the source field is {!Opportunity.Name} and target field is 00n60000001uwgo, right?

I have tried various combinations to launch the Ticket in edit mode with the Name pre-populating. None work: 

/a03/e?retURL=%2Fa03%2Fo&{!Opportunity.Id}&"&00n60000001uwgo="&{!Opportunity.Name}&"


/a03/e?retURL=%2Fa03%2Fo&{!Opportunity.Id}&"&00n60000001uwgo="&{!Opportunity.Name}

 

/a03/e?retURL=%2Fa03%2Fo&"&00n60000001uwgo="&{!Opportunity.Name}

 

I’m stumped. Can anyone help me.  I have a few other fields I want to pass from the Opportunity to the Ticket, but if you help me with this first field I’m sure I can figure it out

 

Finky

 

Custom Button Settings

Type:  Detail Page Button, Behavior=Display in new window, Content Source=URL

 

Greg HGreg H
I have not actually tried this but I think there is a problem with your combination of ampersands (&) and quotes (").  Presuming that your ID/Name for the custom field is "00n60000001uwgo" then you can simply remove the miscellaneous ampersands and quotes around the passed value.
 
For example:
&00n60000001uwgo={!Opportunity.Name}
 
You should only use the ampersand (&) when separating the values you are trying to pass to the edit page.
 
Hope this works,
-greg
Finky9Finky9
Greg,
Thanks for your thoughts.  I still can't get it to work. I have a question1. How do I combine your suggested syntax:

&00n60000001uwgo={!Opportunity.Name}

with my syntax (which works properly and  opens a new Ticket in Edit mode)

/a03/e?retURL=%2Fa03%2Fo

How do I put them both together?

Dave

Greg HGreg H
Hi Dave,
 
Access to your custom object in edit mode is actually driven by the "/a03/e" part of your syntax.  "a03" being the reference to the custom object and "/e" being the reference to the edit screen as opposed to the detail screen. The "?retURL=" piece declares to the edit screen that the user should return to whatever follows the equal sign if the user clicks the save button after accessing the edit screen.
 
To link everything together I would try syntax like this:
Code:
/a03/e?retURL={!Opportunity.Id}&00n60000001uwgo={!Opportunity.Name}

When clicked this should direct the user to the edit page of your custom object and pre-populate the opportunity name in your custom field "00n60000001uwgo".  This syntax will also allow the user to return to the Opportunity (detail page) from which the custom object edit screen was accessed upon saving or canceling.
To pre-populate any additional values on your custom object edit page you can simply append an ampersand, the field name, an equals sign and the value you want the field to contain to the end of the code above.
 
i.e.
Code:
/a03/e?retURL={!Opportunity.Id}&00n60000001uwgo={!Opportunity.Name}&AnotherFieldName=ValueToDisplay

I hope this proves helpful,
-greg