Lightning Component Actions


In this blog, I am going to explain how to custom actions to customize lightning and  Salesforce1 experiences with both global actions and quick actions. Global actions are not associated with any object means you can insert data that is not going to establish any relations other record and Object-specific actions are associated with the object so it allows creating records that have automatic relationships to other records, make updates to specific records. To available Lightning component as actions, you need to implement either the force: LightningQuickAction or force: LightningQuickActionWithoutHeader interfaces.Add the force:hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the current record. When we implement the force:lightningQuickAction interface display in a panel with standard action controls, such as a Cancel button. If instead, you want complete control over the user interface, use the force: lightningQuickActionWithoutHeader interface. Components that implement the force:lightningQuickActionWithoutHeader display in a panel without additional controls and are expected to provide a complete user interface for the action.

Object-Specific Actions
What we are going to do it here, we will create a quick action that is going to create a quote from the opportunity. Create an apex class as shown below and the apex class is used to communicate to server-side actions to save the Quote.

Go to developer console and create a new lightning component name ” Quick Quote” with below code

Here is Lightning component controller code.

The createQuote action handler method will do the following action

  • Invoke server action to save the quote by calling component.get(“c.saveQuote”) from the apex class .
  • Defines a callback function to handle the server response.
  • Enqueues the server action by calling” $A.enqueueAction(saveAction)
  • handleCancel Closes the action panel by firing the force:closeQuickAction event.
  • Displays a “toast” message that the Quote was created by firing the force:showToast event.

Go to Opportunity and create an action as shown below.

Add it to the opportunity  Salesforce1 and Lightning Experience Actions section on the page layouts to create quote by using actions.


Global Actions

Now we are going to create global actions that allow users to create the new user from the global action.
create a new apex class “CreateNewUser” with the below code.

Go to developer console and create a new lightning component “CreateNewUser” with below code.

Here is the component controller.

Go to Global action from the setup menu and create a new global action as shown below.

Go to publisher layout from the setup menu and add the lightning component create to the layout as shown below.

You can access global action from salesforce global header.








Visualforce Page Actions


In this blog post, I am going to explain how to set up global actions and object-specific actions by using visualforce page.The global action which we are going to see in this blog is to send the message to slack channel and object specific action is to take the case ownership from the assigned queues.

Global Actions:-

As we are going to going to post the message to slack by using the global action, go and create a Slack app and get the slack token. Please refer this link

visualforce page is here below


And the controller is here.

Go to set up, find global actions and create a new one as shown below.

Add to the publisher layout as shown below.

After saving the publishers layout you can able to see the quick actions as shown below.

Object Specific actions

Now I am going to walk thru how to create the object specific action.To associate an action to object you need to user standardController attribute of the object. Here we are going to create a Case Quick actions which are allowing the user to take the ownership of the case from case queue.

Here is the visual force page

The controller is here below.

Both in global action and Object actions, I set showQuickActionVfHeader to false. So that we will not able to see the Standard Submit and Cancel Global action header.

Now go to Case Object buttons and links and create a new action as shown below

Add the object to quick action, salesforce 1 and lightning action on page layout based on whether you wanted to show on salesforce class or salesforce 1 as shown below.


Publisher Events

Refresh feed (desktop) 

Submit hook (Salesforce1)

Close publisher event

Activate publish button 

Clear Panel State

Show Panel State 

Success State 


Redirect (Salesforce1)


Salesforce Quick Actions


In this blog post, I am going to explain salesforce action. Actions enable users to do more in Salesforce and in Salesforce1, the Lightning experience depends on the chatter settings. You can create an action and add them to the Chatter publisher on the home page, on the Chatter tab, in Chatter groups, and on record detail pages.  In Salesforce Classic, actions appear in the Chatter publisher. In Lightning Experience, actions appear in different areas of the user interface, depending on the action’s type. In Salesforce1, actions appear in the action bar, its associated action menu, and as list-item actions.

Action Categories

Actions have the different type of categories

Standard actions

Standard actions are actions that are included automatically when Chatter is enabled: Post, File, Link, Poll, and, in organizations that use, Thanks, Announcements are default actions.

Default actions

Default actions are Salesforce predefined actions to get you and your users started using actions in your organization. Add default actions to publisher layouts to make them available to your users in the full Salesforce site and the action bar in Salesforce1.

Mobile smart actions

Mobile smart actions are a set of preconfigured actions, just like default actions, and are supported on the same list of objects. However, they appear in pre-Winter ’14 organizations and are displayed only in Salesforce1.Mobile smart actions are populated with all your organization’s required fields on the relevant object, regardless of how many fields there are.Mobile smart actions don’t appear in the full Salesforce site, regardless of which page layouts you add them to; they appear only to users in Salesforce1.

Custom Actions

Custom actions are actions that you create and customize yourself, such as Create a Record, Send Email, or Log a Call actions. They can also invoke Lightning components, Visualforce pages, or canvas apps with functionality that you define.

Productivity Actions

Productivity actions are predefined by Salesforce and are attached to a limited set of objects. You can’t edit or delete productivity actions.The actions include Send Email, Log a Call, Map, View Website, and Read News.

Type of Actions

Within the categories of actions, you can have different types of actions, depending on their function.

  • Create actions let users create records.
  • Send email actions available only on cases, give users access to a simplified version of the Case Feed Email action on Salesforce1
  • Log call actions let users record the details of phone calls or other customer interactions.
  • Question actions enable users to ask and search for questions about the records that they’re working with.
  • Update actions users make changes to a record.

Steps to define Quick action

Now it’s time to define the quick action. defining quick action contains the below steps.

  1. Enable Actions in the Chatter Publisher
  2. Enable feed tracking for the objects for which you want to make actions available.
  3.  Enable actions in the publisher if you want to see both standard actions and non-standard actions in the Chatter publisher.
  4.  Optionally, enable feed updates for related records to display feed items on a record detail page when related records are created.
  5.  Create object-specific actions or global actions.
  6.  Customize the action layout with the fields that you want users to see when they use the action.
  7.  Add the actions to page layouts or global publisher layouts.

1. Global Actions 

Let’s create a global action that allows users to create an order from chatter.Global actions let users do tasks such as creating records or recording call details directly from the publisher on the Home tab, the Chatter tab, the action bar on the Salesforce1 feed, and Chatter groups.  You can also add global create actions to record detail pages.  Global actions enable users to create object records, but the new record has no relationship with other records.

  1. From Setup, enter Actions in the Quick Find box, then select Global Actions.
  2. Click New Action.
  3. For Action Type, leave Create a Record selected.
  4. For Target Object, select Order.
  5. Enter Label as “New Order”
  6. On Success Message Enter “Order is successfully created “

After click on Save page will redirect to action layout which allows users to customize action layouts as shown below. action layouts are similar to page layout where you can add fields to layouts. add the fields as shown below and click on save.

Predefined field values

Predefined field values will populate the values with predefined values on the action. Setting up predefined values for certain fields on actions can increase your mobile users.  Go to global action New Order which we created. you can see related predefined values.In the Predefined Field Values related list, click New and add fields as shown below.

Adding to Global Publisher Layout

Global publisher layouts determine which actions appear in the publisher in various pages throughout Salesforce, including the Home tab, Chatter tab, and Chatter group detail pages in the full site, as well as the action bar and action menu in Salesforce1. Global publisher layouts can include only global actions. Go to publisher layout edit and add the global action as shown below

Now you can able to see global action on chatter feed as shown below


2. Object-Specific Quick Actions

Object-specific actions let users quickly create or update records, log calls, send emails, and more, in the context of a particular object.You create object-specific actions in the context of the object. object-specific create actions create records that are automatically associated with related records. For example, you add an object-specific action on the Account object that creates contacts. If a user creates a contact with that action on the detail page for the Acme account, that new contact is automatically associated with Acme.Object-specific update actions make it easy for users to edit records. You can define the fields that are available for update.Let’s assume that you wanted to create a Competitor from the account feed. We are going to create a quick action on the account.

Create an Object-Specific Action

Go to Account Object -> go to Buttons, Links, and Actions and click New Action and create an Action as shown below

Add an Action to Account Page Layout

After creating an action you need to add to the page layout to appear in the feed. Go to Account Page and add the action as shown below.Finally, you can see the Action on feed as shown below.