Salesforce Actions

Have you ever tried to look for Salesforce Actions in google? Unless you are completely sure what you are looking for, you can be lost reading many entries that talk about different features.

This new post will cover these points and also show examples using them.

  1. Global Actions variables
  2. Action attributes on Visualforce pages
  3. Chatter Actions
  4. Quick Actions
  5. Invocable Actions with APIs

Global variables help you to show general information about the current user and the organization. They are used on Visualforce pages, with the syntax {$GlobalVariable.Value}

But here, we will focus on the Action one, that allows you to refer Standard Actions related to an object like create, edit, update or delete. For instance, this piece of code will show a link in a page that goes to a New Account Standard UI page:

<apex:page>
    <apex:outputLink value="{!URLFOR($Action.Account.New)}">
        Create New Account
    </apex:outputLink>
</apex:page>

We can continue talking about actions on visualforce pages. When we want to do something after clicking on a button, we must define an action there. How? Just adding the action attribute on the tag. For instance, bellow code is a visualforce page that allows you create a new Account record after entering its Name and clicking on the save button that the tag <apex:commandButton> shows.

<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save Account" action="{!save}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:inputField value="{!Account.Name}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Remember that in order to show this page you only need to add /apex/<yourpagename> to the url:

 https://<instance>.visual.force.com/apex/<yourpagename>

And this is an example of the result:

Captura de pantalla 2015-03-20 a las 12.41.02

Chatter Actions allow you to do something on an object via chatter. What does it mean? On Chatter, apart from the common actions like Comment, Link, Post, etc, we can create some others in order to perform a new action quickly. As you can see on Salesforce help, there are different actions, and here, I will create a custom action related to the Account standard object.

Tip: remember to have chatter enabled

Steps are:

1. Go to Setup | App Setup | Customize | Accounts | Buttons, Links and Actions and create a new Action in order to create an Opportunity related to the Account

2. Include in the Page Layout those fields that you want to populate during the Opportunity creation

3. Add the new Quick Action into your chatter post.

These images shows above steps:

Captura de pantalla 2015-03-20 a las 13.04.30

4. Open your Account and select the new Quick Action.

Captura de pantalla 2015-03-20 a las 13.13.28

5. Populate Opportunity fields with the information and click save

6. A new Opportunity and a chatter post on Account record are created

Captura de pantalla 2015-03-20 a las 13.14.37

Like previous point, Quick Actions will allow you to perform an action faster than usual in Salesforce. One of the main differences is that Quick Actions help you defining a global action in the org and you will be able to run it from your User chatter post instead of just the post related to a record.

Salesforce already provides Quick Actions for Standard objects, so my action will allow me to create a new custom object record, Trip Request.

Tip: remember to have chatter enabled

Steps are:

1. Go to Setup | App Setup | Create | Global Actions | Actions In a similar way as before, define the new action.

2. Include in the Page Layout those fields that you want to populate during the Trip Request creation

3. Add the new Quick Action into the chatter post.

4. In order to run it, you just need to go to your chatter feed:

Captura de pantalla 2015-03-20 a las 13.26.38

or you can also run it from your SF1 mobile app

Captura de pantalla 2015-03-20 a las 13.30.15

5. Populate Trip Request fields with the information and click save

6. A new Trip Request and a chatter post related to your user record are created

Captura de pantalla 2015-03-20 a las 13.37.20

If someone talk about Invocable Actions, we could think that is something more difficult than what it is actually.

As you can see in the help, via REST API we are able to get all actions that we can find in the org and can be called by API.

Tip: bellow examples are run via Salesforce Workbench

An easy example is to execute this line on Workbench:

/services/data/v33.0/actions

Tip: It is available only via REST API 32.0 onwards

What do we get? All actions, custom and standard one.

Captura de pantalla 2015-03-20 a las 14.06.03Workbench also allows us to navigate across the options, and in this way we can see how under custom we can find the 2 actions we have created on above sections:

The one related to Account that creates Opportunities:

Captura de pantalla 2015-03-20 a las 14.07.11And the Quick Action that creates Trip Requests:

Captura de pantalla 2015-03-20 a las 14.06.18

Salesforce Elevate – Bilbao 2015

Una de las cosas que más me sorprende y gusta de Salesforce, es la ayuda que ofrece siempre al desarrollador. Por eso ha creado una comunidad inmensa alrededor de la plataforma que nos permite compartir ideas, problemas, soluciones, ó simplemente nos ayuda a que podamos hablar cara a cara con otros usuarios. Por eso comenzaron los Salesforce Developer Group. Sesiones localizadas en distintas ciudades donde los desarrolladores de Salesforce se reúnen para hablar de una manera totalmente informal, sobre Apex, Visualforce, APIs, novedades en las releases, etc.

Hace un par de años tuve la suerte de poder iniciar el grupo que celebra estos SDG (anteriormente conocidos como DUG) en la zona norte de España, en concreto en Bilbao (North Spain Salesforce Developer Group) y la verdad es que la experiencia fue muy positiva. En primer lugar porque pude decir eso de ” ¡¡no estoy sola!! ” y segundo porque por una vez, estaba bien eso de discutir cosas de Salesforce en mi idioma. Además, tuve la gran suerte de encontrar desarrolladores deseando de compartir sus experiencias las cuales eran muy distintas a las mías.

Pero después de un par de años, el grupo comenzó a pensar en hacer algo más grande y por fin, el pasado 26 de Febrero pudimos celebrar el primer Salesforce Elevate en España.

La principal idea era dar a conocer Salesforce a los desarrolladores de la zona, y para ello contamos con 4 compañeros que nos guiaron sobre distintos temas en sus talleres. Pero antes de empezar con lo que nos gustaba, y teniendo en cuenta que no se había celebrado un evento similar en la zona, no estaba de más comenzar con una presentación de Salesforce y una introducción de algunas empresas como NTS, Clapps, y por supuesto FinancialForce.com.

Sergio - FinancialForce

A continuación era nuestro momento, y Carolina (Force.com MVP), nuestra estrella invitada, nos habló largo y tendido de la Comunidad, los SDG, los eventos que se iban a celebrar en España en breve, cómo podemos seguir aprendiendo de Salesforce día a día, las horas de oficina en Español, etc.

Carolina - Force.com MVP

Y una vez hecha una buena introducción, tocaba la hora de empezar a trabajar un poquito con el ordenador. Los talleres trataban temas básicos, pero siempre hay que empezar por el principio ya que sabíamos de antemano que parte del público no sabía nada sobre la plataforma.

Les enseñamos a crear aplicaciones, objetos, campos, relaciones, reglas de validación. Por otro lado, cómo modificar el look and feel de la interfaz, como usar el Schema Builder de Salesforce etc. Por la tarde contamos con dos sesiones. La primera dedicada a los dispositivos móviles y ver como todo lo que por la mañana habíamos desarrollado con clicks de ratón, #clicksnotcode, se podía visualizar sin problemas en nuestro móvil ó tableta. Y finalmente, para aquellos que estaban deseando picar algo de código, tuvimos un taller en el que pudimos aprender algo de Visualforce y Apex. ¿Te interesa echar un vistazo al material que usamos? Todo está en shareslides. Y en github puedes encontrar el código que usamos.

La verdad es que la experiencia fue muy buena y no descartamos celebrar otro evento el año que viene. Admitimos sugerencias sobre temas a tratar!!!

Ah!! Y si estás por Bilbao, apúntate a nuestro Salesforce Developer Group y ven a las reuniones que puedas. La próxima, Lightning week.