By Vikas Menon
Publisher Actions let you create standard or custom actions (e.g., create a record) and place them in the Chatter Feed section on the homepage, Chatter tab, in Chatter Groups, and on record detail pages.
It also replaces the URL hacking by configuring the predefined values on an object. For example, if you need to create a contact on a related account with some predefined value in fields like Title, Last Name, or First Name. Publisher actions let you create a contact on an account with predefined field values, rather than populating values in the URL. There are two types of publisher actions:
- Object specific actions
- Global actions
Creating an action enables users to create records, while respecting the validation rules and field requiredness. This Action appears on the Record Detail page. (You can create case record on Account Detail page using this action.)
1. Go to Setup | Customize | Account | Buttons, links and actions | New Action button
2. You can select the Action Type as Create a Record, in order to create a case on the account. Object type is defined in the target object. We also specify the label of create action and save it. Select various Other Action types per the requirements.
3. Once the above action is created, add it on the account page layout.
4. On the Chatter feed of an account record, the Create Case action created above would be displayed. Click on it, and a new section will be displayed with all case-related fields through which users can create a related case for the account.
In the case of pre-populated case fields, configuration is required in Action definition page.
We use custom code to implement this action. Custom actions can be used in the form of a Visualforce page. One can easily design a Visualforce page, which will use a controller for the related record.
For example, if you need to find open and closed cases on an account, you need to create a visualforce page that will use a controller in which the Account Record is taken into standard controller.
1. Create a Visualforce page
2. Create a Controller for above visualforce page
3. Go to Setup | Customize | Account | Buttons, links and actions | New Action button and fill the values, and select the above created page in the VisualForce Page section.
4. Add the custom action on the account page layout. Follow the point #2 of ‘Object Specific Action’ -> ‘Creating an action’ as given above.
5. Go to the Account record and click the ‘Cases snapshot’ action. Here is the output of the created custom action above: