4

After having a URL hack break on me recently, it made me wonder: what is the SF-approved method of pre-populating fields on an object? Is the expectation that we are supposed to create a VF page to accomplish something so simple? It just seems like a lot of overhead.

Also, after examining the AJAX API it seems to me that it is doing the exact same thing as a URL hack, but has the added drawback of having to make an API call. Is this understanding correct?

Use Case

I want the user to be able to click a custom button on an Account page that will pre-populate fields on a task. The user will then supply additional information in the fields and save the record. The asignee is one of the fields that has been populated automatically.

3
  • Sometimes you can't do really simple things OOB unfortunately.
    – Adrian Larson
    Apr 17, 2015 at 15:48
  • @AdrianLarson, so is my assumption that the SF-approved method would be to create a VF page in this case? I'm fine with that approach, I was trying to poll the community to see if there was a quicker -- and legitimate -- way of doing it.
    – toolshed
    Apr 17, 2015 at 15:51
  • Sans URL Hacks that would be my standard MO, yes.
    – Adrian Larson
    Apr 17, 2015 at 16:00

2 Answers 2

7

If you use chatter, you could use actions to populate your defaults. More info can be found here.

Here are some screen shots of a quick example of how it would work:

Account Actions Predefine Field Value
Using Action

4
  • This is pretty interesting, but is there a way to incorporate this as a custom button? It's interesting that this functionality exists for chatter, but nowhere else. Perhaps I could use the Chatter API and link the code to a button? Still, that would likely consume an API call. Not worth it for something that a simple VF page would fix.
    – toolshed
    Apr 17, 2015 at 19:26
  • Not that I can find.
    – Jenny B
    Apr 17, 2015 at 19:47
  • Just use Quick Actions as the answer states. Don't use buttons. Buttons are annoying, look ugly when you have too many, and don't work well in Feed Layouts.
    – JodieM
    Apr 17, 2015 at 22:16
  • 1
    You can edit the order of the publisher actions within the page layout, so that you don't need to use the More... link to find the "new task" publisher. Apr 19, 2015 at 5:04
0

@Jenny B's answer is probably the right one for handling most of the URL hacks through buttons. I agree that it would be nice to map the Publisher Action to a button. I'd like to point out that Salesforce1 is much nicer to Actions than buttons.

To answer your second question about the AJAX API - sort of
The benefit of course is that it's supported by Salesforce and we won't see this disappear over time (hopefully). It also uses standard naming for standard fields instead of the url hacky (opp3, cas14, etc) craziness.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .