One of the most interesting – but least explained – features of Summer 13 (184) is Chatter Actions. There are three kinds of actions (Yes, you thought there were two, but there are more!) and after writing a few of each, here are some examples. The documentation is, as of this writing, both incomplete and incorrect, so this should help a bit. I also found some gotchas when using Chatter actions in a specific setting.
Chatter Actions fall into two major categories: “Create a Record” and “Custom Action.” There are two locations for Chatter Actions: Object-specific and Global, meaning that Create actions and Custom actions can each be executed from a specific object Chatter publisher or can be created from the general publisher found on the Home and Chatter tabs.
- Create action
- Custom action
Clear, right? We could visualize it as first Object-specific, then Global, but that wouldn’t demonstrate the real differences and advantages/drawbacks.
This is the first of two blog posts. Today we’ll deal with “Create action” Publisher Actions.
Global Create a Record Actions
These are the most simple of any action. Select any object from the picklist (even ones that are not Chatter-enabled), name the action, and hit save. The icon matches the tab icon, unless there is no tab; for those, you will need to pick an icon you have uploaded as a static resource. There is no choosing from the existing tab icon set we have grown to know and love over the years.
Next, edit the layout to show about 8 fields, and provide default values for picklists, text fields, etc. You cannot provide default values for lookups.
These records can be created from anywhere, including the Home and Chatter tab Publishers, and they are standalone. That means that they do not default any lookups to any values. Want to insert a Case? That’s great, but you will need to type the Account and/or Contact in the proper fields. Want to add a Task and relate it to a Case? Have fun; you’ll need to find the Case Number and type it in the proper box. And good luck auto-filling the Contact on that Case without using a trigger.
More sophisticated orgs will want to avoid using Global Create actions because even entering an Account record is probably more complicated than can be encapsulated in 8 fields – that don’t recognize page layout-level read-only attributes. That’s right: These create actions are truly global.
So I guess you’ve figured out that I’m not a big fan of Global Create actions.
Object-Specific Create a Record Actions
I like these a lot more. Choose an object (standard or custom), add an Action, select Create a Record, choose from any child object, plus Task and Event (if the object is Activity-enabled), add a Label and Name, update the layout, and you’re off to the races.
In this example, the relevant lookup field is populated. For example, if you create a Task in a Case action, the Task WhatId field will be populated with the Case Number. Again, you’ll need to use a trigger if you want to populate the Task Contact with the Case Contact, but that is beyond the scope of this post.
Of course, what would a post be without saying “But there’s a catch – there always is?”
Publisher actions can only be executed from the Chatter publisher. This means that you can set them up for any object, but you can only customize the Chatter Publisher on page layouts for objects that have Chatter feed-tracking enabled.
There are far more gotchas with Custom actions, but you’ll have to wait for the next post to see those. I will show code for creating a Task from a Case, creating an Account from the Home tab, and creating a Task from a Case while using Case Feed.
There you have it: Create a Record Custom Actions.