Initiating Actions from Reports

Reports in Salesforce.com are great because you can query Contacts. And then you can drill down to a Contact’s record to do things like edit them, or add an Opportunity, etc.

But “drilling down” is really just a euphamism for “you have to click again.” And I think the goal of a web app is to remove as many clicks as possible. So I drive events from reports where it makes sense.

On this report, I can edit or delete any Opportunity that is listed. This is a pipeline report that shows all my CRM projects. I can easily move them from one stage to another without having to drill down.

This report is a list of Contacts. With one click I can start the process for adding each one to a Campaign. Again, no drill down. No extra clicks necessary.

I created two custom fields that can now be included on any Report or View that I have. Salesforce.com lets me add action links all over the place, which is freakin’ cool.

Edit Delete Link

In this example I created this field on the Opportunity object, but the same notation should work on any object.
Field Data Type: Formula
Field Label: Edit Delete
Formula Return Type: Text
Formula:
HYPERLINK("/" & {!Id} & "/e", "Edit") & " | " & HYPERLINK("/setup/own/deleteredirect.jsp?delID=" & {!Id}, "Del")

Add to Campaign Link

This only works on the Contact object
Field Data Type: Formula
Field Label: Add To Campaign
Formula Return Type: Text
Formula:
HYPERLINK("/00v/e?retURL=%2F" & {!Id} & "&parent_id=" & {!Id} , "Add to Campaign")

CRM is about looking up information, but it’s more importantly about action. Enable your users to act in as many places as possible.

Update: We had some earlier problems with copying and pasting the hyperlink fields causing syntax errors in Salesforce.com. Kingsley pointed me to the fix, and all is well now. If you ever want to post formula fields on the web, wrap them in CODE tags!

51 Responses to “Initiating Actions from Reports”

  1. Kingsley Says:

    Very slick!

  2. Steve Says:

    Thanks, Kingsley!

  3. Eugene Chan Says:

    Been subscribed to your weblog for a while. Really good information including this post. Keep it up.

  4. Steve Says:

    Thanks Eugene. Nice to hear you dig it!

  5. Scott Says:

    This is a very cool idea and totally agree about allowing action from multiple perspectives. Nice work.

  6. AJ Says:

    Very cool…but kept getting a syntax error when trying to add the field…I did a copy and paste…guessing I am missing something. Please help.

  7. Gareth Says:

    Nice work, well done!

  8. Steve Says:

    AJ: copying and pasting sometimes inserts spaces that cause syntax errors. Remove extraneous spaces and it should be OK.

  9. Kingsley 2.0 Says:

    List of Salesforce.com bloggers

  10. AJ Says:

    Thanks Steve that did the trick!

  11. Steve Says:

    Great AJ!

  12. Successforce Blog Says:

    Edit and Delete Records Directly from a Report with Custom Buttons

    Today on the message boards gokubi posted a great best practice idea for initiating actions directly from a report. The way Salesforce’s reporting tool works is that you click through to view the record but it’s one more click if

  13. Brooks Jordan Says:

    Simplicity will set us free, right? Thanks for these Steve.

  14. SalesForceWatch.com Says:

    One Less Click

    Steve has posted an excellent write-up on using forumula fields on reports and views to let users take action directly from those screens rather than drilling-down into the report/view. gokubi.com: Initiating Actions from Reports

  15. Steve Says:

    Thanks Brooks! The folks at Salesforce make these great innovations, and it’s wild how we all slowly discover ways to wield them. I’ve been having a blast lately. I’ve got a really interesting one up my sleeve that I think people will have fin with…just got to get through this project work!

  16. Chris Says:

    Steve, I initially ran into the same error I think AJ hit, but for a different reason – for some reason it didn’t like my copy/paste and I had to manually type the formally in (literally replacing a pasted quote with a manually-typed quote, etc.). The formulas now function well, and it’s a great hack – however it does open the link in a new window. Anyone else experiencing this or have a tip to push it back within the same window/tab the initial report was in? Thanks!

  17. Keith Says:

    This is brilliantly simple! Thanks for sharing.

  18. Steve Says:

    Thanks Keith. The real brilliance is in the way sf.com has developed their web app. They’ve made so many of the applicaiton action links discoverable and recreatable dynamically via hyperlink formula fields. I’ve used plenty of webapps that don’t do that well.

  19. Steve Says:

    Chris: hyperlink fields open a new window by default. I use Firefox and tell the browser the whenver a link tries to open a new window, force it to open a new tab instead.

  20. John Nail Says:

    Great ideas!!!

    The link as shown below does get past the validation (the spaces seem to have been the problem)but I get this error message:

    “Unable to access page.
    Information needed by the page you have attempted to access is incorrect. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.

    Click here to return to the previous page.”

    HYPERLINK(”/00v/e?retURL=%2F” &”parent_id=”,”Add to Campaign”)

  21. Steve Says:

    Looks like your HYPERLINK lacks the dynamic insertion of the Id, which is what makes this technique work. {!Id} is the notation that goes out and gets the current object’s Id. Hope that helps!

  22. Chris Says:

    Thanks for the reply, Steve – while I love the hack, it would be great to continue having my Salesforce.com operating within one tab, instead of popping open a new one. You know how you can choose the window properties for Custom Links within Accounts, etc.? Something like that (”Open in Salesforce window without sidebar”)…

  23. Steve Says:

    Sorry, HYPERLINK fields always open in a new window–that’s the way Salesforce.com has built them, and they don’t let you make them behave differently. I personally love working in multiple tabs of a browser, especially in Firefox. Try it, I think you’ll like it!

  24. Kingsley Says:

    Steve, you may want to stick the formula inside a code or pre tag.

  25. Steve Says:

    Thanks for the tip Kingsley. CODE tag did the trick. Copy and paste no longer causes syntax error in formula.

  26. Schlink Says:

    Great ideas!

  27. Steve Says:

    Thanks Schlink!

  28. Tomasz Says:

    We use SFDC primarily for Support and Services.
    I just added this trick to majority of our “Support” reports. It’s an awesome time saver.
    Thanks!

  29. Steve Says:

    Cool Tomasz. Glad you find it helpful! You could probably create a “close case” link as well, if that would make sense.

  30. Tomasz Says:

    Hi Steve, Funny enough I’ve already done it using “/s” parameter. I am still trying to figure out if it’s possible to pass/change field values via URL. Example change Status field value from “New” to “In Progress”. We have done it with Java Script (and Custom Links), however URL will be very neat.

    Also, there is a “half” solution for Chris question about HYPERLINK and a new window. Firefox allows you to force new links to open in a new tab (Preferences | Tabs). It works well with SFDC function too.

  31. Kingsley Says:

    You’re welcome.

    Tomasz: We’ve been recommending variations of the new window/tab method for a while. In Firefox, you can also drag and drop a link on the tab bar (or a specific tab) to open it.

    I’m curious about the /s parameter though – care to share more?

  32. Tomasz Says:

    Hi Steve,
    I cracked it. It was easy to change custom field values as their IDs as visible via URL. I followed your “conversation” with Ron Hess and I was able to snoop on “Status” field via View Page Info | Form | editPage label.

    He is the custom link which clones a case, links it back to the original case (via a custom field 00N20000000mmrC) and changes “Status” field (cas7) to “In Progress”

    https://emea.salesforce.com/{!Case_ID}/e?&clone=1&cas7=In%20Progress&00N20000000mmrC=https://emea.salesforce.com/{!Case_ID}

    And yes, I used it too to pass ad hoc parameters to a standard reports.
    I think Ron Hess’s tip deserves a medal!

  33. Steve Says:

    Ron’s a super star! Nice work Tomasz, I like what you’ve done. I’ll have to go back to that conversation with Ron and refresh a bit. It helped me with Campaigns, but I’ll have to look into other objects as well. The way I generally work is use an S-Control to create an object and then pop it up in Edit mode. this way is really interesting…

  34. Jeff Says:

    Awesome! thanks for the post.

  35. Gary Says:

    Excellent bit of functionality. One thing just to be careful about is that if the report has a lot of columns then the Edit / Delete buttons appear one above the other – and very close to each other. This means its easy to unitentionally click Delete, in which case the record is deleted without warning.

    I’ve actually removed the Delete from both the field label and the formula to prevent this happening. I don’t think its a big loss from a user perspective as most of the time they want to update rather than delete opportunities (arguably opportunities should never be deleted, just closed).

  36. Ian Says:

    Can this be taken one-step further where the action changes a custom field value and then saves and closes the pop-up window? That way the report acts more like an editable worksheet. We are looking for a simple way for users to add/remove a contact from a specific mailing list.

  37. Steve Says:

    Sure, you would just have to write the S-Control that would do the action you require. Then create a formula field that calls the S-Control and put that link on your report/view.

  38. kkkkoaaa Says:

    Keep a good job up!

  39. Jane Says:

    Thanks so much for this neat little trick! I created two – one with the Delete part and one without, like Gary suggested. Keep up the great stuff and thanks for sharing.

  40. Brian Says:

    Sorry, Figured out the redirect issue

  41. petyr Says:

    First, great Tool.

    Second, to Gary’s point. This there any way to include in the formula a pop-up box that would warn the end user they are about to delete data? This would be the icing on the cake to an already cool functionality.

    If it has to be done via an s-control, any idea how that would work?
    Thanks,
    p

  42. Steve Says:

    An actual delete link on a regular sf.com page looks like this:

    onclick="if (window.confirm('Are you sure?')) window.location='/setup/own/deleteredirect.jsp?retURL=%2F003%2Fo&delID=0034000000Kysil'"
    

    I haven’t tried this, but you might be able to insert the js popup as in this example…

    Good point!

  43. Paul Says:

    The sf user community is salesforce.com’s greatest asset. Your tips were very helpful and I put them to use immediately.

    Thanx,
    Paul

  44. Steve Says:

    Glad you found the post helpful! I agree, users are a great source of tips and cool ideas.

  45. Jeremy Says:

    Nice work on this one! – I’ve got it up and running. I’m trying to create the same but the URL I actually want to go to when I click the link is the next step, to assign the member status.

    How would I do this?

  46. Steve Says:

    If you set up the Add to Campaign button like it’s shown above, it should drop you on the choose member status page.

  47. Andy Says:

    I think this is great. However, I have a slightly different question. We’re trying to manage everything from within the Tasks.

    Is there a way to use the above to allow a user to update Member Status from within a Task? They want to avoid any extra mouse clicks, such as going to the Contact/Lead record and clicking Edit on the Campaign listed in their Campaign History.

    Thank you

  48. Steve Says:

    Yes you could. Just create a formula field on Activities and use the WhoId field, which will be either the Contact Id or the Lead Id of the person the Activity is related to. The link you create will only show on the detail page of the task. To get all Winter ‘07 on it, you could create a button on the Task that calls the URL. Then each Task would have Edit | Delete | Add Contact to Campaign as buttons across the top. Check out the Winter 07 documentation to try that out.

  49. Ksenya Says:

    This is really awesome, thanks for the tip!

  50. Brendan Lally Says:

    I am creating an example the same as yours on a custom object.
    I am creating a custom field, type text, size=250 and then using
    HYPERLINK(”anywhere” , “Do stuff”)

    I am getting Error: Function HYPERLINK may not be used in this type of formula

    any ideas?
    in developer edition

    Lal

  51. Brendan Lally Says:

    Duh! I had set it up as New field, Text, formula, Hyperlink
    needed 2b New Field, Formula, Text, Hyperlink

    Lal

Leave a Reply