2 answers
Well, this is called URL Hacking. So each and every element that you see on a Page may it be a drop down, a text box, a checkbox or whatever has unique ID of it's own. So we actually have a way to find the unique ID of an element. When you right-click an element, you would see a pop-up menu and from the same, select Inspect Element. This feature( Inspect Element ) is Browser specific feature. On selecting the Inspect Element, a small docked window would open at the bottom of the page highlighting that very element. You can also see the ID too from that same window. See here:
This tells us that the ID of the location text box on an Event Page is: evt12.
So in Force.com, if you want to pre-fill an element on the Page with a pre-defined value, you can set that via the URL.
So if you notice the Event page(reached by clicking the New Event button from the Account page would look like this:https://ap1.salesforce.com/00U/e?what_id=0019000000Js5oW&retURL=0019000000Js5oW
So you can notice these:
what_id=0019000000Js5oW
retURL=0019000000Js5oW
So these are some that's there out-of-the-box. We can similiarly mock this:
https://ap1.salesforce.com/00U/e?what_id=0019000000Js5oW&evt12=Bloomington
Notice the: evt12=Bloomington
So in essence, what we have to do is, to create an another New Event button which will set and then send in the ev12 with a value fetched from the Account page.So let us make one then:
- Go to Setup | Customize | Activities | Events Buttons and Links
- Click New Button or Link
- Label it as New Event With Location
- Display Type: List Button
- Un-check the option - Display Checkboxes (for Multi-Record Selection)
- Behaviour: Display in existing window without sidebar or header
- Content Source: URL
- URL:
/00U/e?what_id={!Account.Id}&retURL={!Account.Id}&evt12={!Account.BillingAddress} - Click Save
We now have to add this new button to the Open Activities Related List on the Account page. So here you go:
- Go to any Account record
- Click Edit Layout from the top right
- Scroll to the Open Activities Related List
- Click on the Wedge icon
- Scroll down and expand the section - Buttons
- Un-check the default New Event
- From the Available Buttons, select our new button and move it to the Selected Buttons
- Click OK
- Click Save
You should be good to go!