Salesforce BigObjects

What is a BigObject?

Two years ago I started working with Big Objects, a Salesforce pilot that looked very interesting for me. And now that it seems that General Available time is closer, I would like to write about them.

Please, take into account that a Salesforce pilot could be discarded like Data Pipeline that it would not be GA at the end.

Big Objects is a new type of objects that Salesforce provides. Maybe the most important thing I can tell is that they do not count against the storage limit. Well, you could say that External Objects already do.

You can learn more about External Objects here.

Yes, you are right. But this time, data lives in your organisation instead of in an external storage and this means that you can work with them like with Custom / Standard objects, but if you go to Salesforce Storage screen, you would not find them.

Big Objects let you store and manage large amounts of data.

Use Case

But before starting with the explanation, let’s talk about the Use Case.

As a company that creates software, we have stories in order to develop new functionality. Before delivering them, we need to pass a code review, so that, we ensure the best to our end users.

Captura de pantalla 2017-07-07 a las 12.21.47

But how much storage should I use to keep code review records in our Production org? Should I remove them? If so, what about auditing?

BigObjects is your solution, so that, you can move old records to a new Code Review History BigObject record. Let’s focus for now on this new History object.

How to Create a BigObject?

Unfortunately you cannot do it in a declarative way. You need to define them via Metadata API and then do a deployment via cmd or workbench.

Before doing it, take into account:

  1. Indexes are required and in order to include them, you need to be on API 39.0 onwards.
  2. Once you deploy one, you cannot make any modification like amend a field type, change label, etc. However in a declarative way you can do small changes like the label and API name.
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
  <deploymentStatus>Deployed</deploymentStatus>
  <fields>
    <fullName>CanBeMerged__c</fullName>
      <label>Can Be Merged</label>
      <length>80</length>
      <type>Text</type>
    </fields> 
  <fields>
  <fullName>CodeReviewDate__c</fullName>
    <label>Code Review Date</label>
    <type>DateTime</type>
    <required>true</required>
  </fields>
  <fields>
    <fullName>Comments__c</fullName>
    <label>Comments</label>
    <length>255</length>
    <type>Text</type>
  </fields>
  <fields>
    <fullName>Employee__c</fullName>
    <label>Employee</label>
    <referenceTo>Employee__c</referenceTo>
    <relationshipName>Employees</relationshipName>
    <required>true</required>
    <type>Lookup</type>
  </fields>
  <fields>
    <fullName>Score__c</fullName>
    <label>Score</label>
    <precision>1</precision>
    <scale>0</scale>
    <type>Number</type>
  </fields>
  <fields>
    <fullName>Story__c</fullName>
    <label>Story__c</label>
    <referenceTo>Story__c</referenceTo>
    <relationshipName>Stories</relationshipName>
    <required>true</required>
    <type>Lookup</type>
  </fields>
  <indexes>
    <type>PRIMARY</type> 
    <fullName>Test1CodeReviewPK</fullName>
    <fields>
      <name>Story__c</name>
      <sortDirection>DESC</sortDirection> 
    </fields>
    <fields>
      <name>Employee__c</name>
      <sortDirection>DESC</sortDirection>
    </fields>
    <fields>
      <name>CodeReviewDate__c</name>
      <sortDirection>DESC</sortDirection>
    </fields>
  </indexes>
  <label>Test1 Code Review History</label>
  <pluralLabel>Test1 Code Reviews History</pluralLabel>
</CustomObject>

Once you deploy it into your organization, you would find something like this under BigObject entry:

I decided to name is as Test1 Code Review History because once it is created I cannot modify it, and I didn’t want to use Code Review History label for now.

Captura de pantalla 2017-07-14 a las 13.03.54.png

What can we highlight?

  1. The API name ends with __b instead of __c or __x like custom and external objects.
  2. We will not find Standard fields.
  3. We can create as many custom fields as we want but right now it only supports these field types: DateTime, Lookup, Number, Text and Long TextArea. What about the rest? Try to be creative. For instance a Checkbox can be converted into number or text.
  4. You will not find any other section like PageLayout or Buttons for now.
  5. You will not find Triggers section. It is not allowed for now.
  6. You will not be allowed to create a custom tab related to this object. That is related to previous point and the PageLayout. To visualise Big Object records, you need to create a visualforce page or a lightning component.
  7. You can determine its CRUD and FLS via Profile or Permission Sets during the deploy process or in a declarative way. However for now BigObjects can be only created and read.

Captura de pantalla 2017-07-14 a las 13.44.36

How Can I Create Records?

There are different ways to create BigObject record, like using a csv file, use APIs like Bulk API or even Async SOQL, another Pilot I will talk about in a future entry.

In any case, here, I will focus on Apex.

As I mentioned above, you can only Read or Create records, and nowadays, you cannot use simple DML operations, there is a new one: database.insertImmediate(record)

Test1CodeReview__b cr = new Test1CodeReview__b();
cr.CanBeMerged__c = 'False';
cr.CodeReviewDate__c = System.today();
cr.Comments__c = 'I found a SOQL inside of a loop.';
cr.Employee__c = 'a6j24000000fxSL';
cr.Score__c = 0; 
cr.Story__c = 'a6k24000000k9bN';
database.insertImmediate(cr);

But something pretty cool that it was not available at the beginning, it is the fact we can use this method, to also update records. Actually it works like upsert. If I make a call where the record has a primary key that doesn’t exist, it would create a new record as we can see in the below image.

Captura de pantalla 2017-07-14 a las 14.28.04

However if the value already is in the platform, it will make a modification.

Test1CodeReview__b cr = new Test1CodeReview__b();
cr.CanBeMerged__c = 'False';
cr.CodeReviewDate__c = System.today();
cr.Comments__c = 'I found a SOQL inside of a loop.';
cr.Employee__c = 'a6j24000000fxSL';
cr.Score__c = 1; //Change to 1
cr.Story__c = 'a6k24000000k9bN';
database.insertImmediate(cr);

Captura de pantalla 2017-07-14 a las 14.35.49

If I come back to the original use case, I would like to move CodeReview__c records to Test1CodeReviewHistory__b records. In order to do that I only need to retrieve the record I need and create a new BigObject entry.

CodeReview__c cr = [Select Id, CanBeMerged__c, 
                           CodeReviewDate__c, Comments__c, 
                           Employee__c, Score__c, Story__c 
                    From CodeReview__c 
                    Limit 1];

String canBeMerged = cr.CanBeMerged__c == true ? 'True' : 'False';

Test1CodeReview__b crh = new Test1CodeReview__b();
crh.CanBeMerged__c = canBeMerged;
crh.CodeReviewDate__c = cr.CodeReviewDate__c;
crh.Comments__c = cr.Comments__c;
crh.Employee__c = cr.Employee__c;
crh.Score__c = cr.Score__c; 
crh.Story__c = cr.Story__c;
database.insertImmediate(crh);

How Can I Visualise Records?

As we have already mentioned, we cannot create a custom tab related to a BigObject and show all records. However we can query BigObjects, so what about if we create a custom page for that?

First of all we would need a controller. Really simple one. We have a method to retrieve all records and a get and set to show in a list what we retrieve.

public with sharing class CodeReviewController
{
   private static List<Test1CodeReview__b> codeReviewHistoryList; 
   
   public CodeReviewController()
   {
      setCodeReviewHistoryList(calculateCodeReviewHistoryList());
   } 

   public List<Test1CodeReview__b> calculateCodeReviewHistoryList()
   {
      return [SELECT Id, CanBeMerged__c, CodeReviewDate__c, 
                     Comments__c, Employee__c, Score__c, 
                     Story__c                
               FROM Test1CodeReview__b];
   }

   public static List<Test1CodeReview__b> getCodeReviewHistoryList()
   {
      return codeReviewHistoryList;
   }

   public static void setCodeReviewHistoryList(List<Test1CodeReview__b> value)
   {
      codeReviewHistoryList = value;
   }
}

Secondly, we have the visualforce page. Something to highlight is that right now, the standardController attribute doesn’t work, so we can only create a page with a customController. 

<apex:page showHeader="true" sidebar="true" controller="CodeReviewController">
   <apex:form>
      <apex:pageBlock title="Code Review History Records">
         <apex:pageBlockSection title="Code Review History" columns="1" collapsible="false">
	    <apex:pageBlockTable value="{!codeReviewHistoryList}" var="crHistory">
               <apex:column headerValue="Ready To Merge?">
	          <apex:outputField value="{!crHistory.CanBeMerged__c}"/>
               </apex:column>
	       <apex:column headerValue="Score">
	          <apex:outputField value="{!crHistory.Score__c}"/>
	       </apex:column>
               <apex:column headerValue="Comments">
	          <apex:outputField value="{!crHistory.Comments__c}"/>
               </apex:column>
               <apex:column headerValue="Story">
	          <apex:outputField value="{!crHistory.Story__c}"/>
               </apex:column>
               <apex:column headerValue="Reviewer">
                  <apex:outputField value="{!crHistory.Employee__c}"/>
               </apex:column>
               <apex:column headerValue="Code Review Date">
                  <apex:outputField value="{!crHistory.CodeReviewDate__c}"/>
               </apex:column>
            </apex:pageBlockTable>
         </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>

And the result is this one that includes the record created from scratch and the one that is retrieved from CodeReview__c object.

Captura de pantalla 2017-07-17 a las 9.14.52

Summary

I would like to share this table that summarise BigObjects and compare with Custom Objects. But before, I would like to also highlight that this new object type can be included in a package. You would find under CustomObject section:

Captura de pantalla 2017-07-17 a las 9.16.06

Summary Table:

Feature Custom Object Big Object
Creation Manual
Metadata
Metadata
API name myObject__c myObject__b
Track Activities
Track Field History, etc.
Options Available Options No Available
Field Types All Text ; Date/Time ; Lookup
Number ; Long Text Area
Able to edit fields Yes Yes (with restrictions)
Able to delete fields Yes No
Triggers; Field Sets; etc Options Available Options No Available
Reports Yes No
How to Populate records All CSV file
API (Bulk, SOAP)
Apex
Async SOQL
Can I amend a record? Yes Yes (with restrictions)
Can I see data creating a Tab Yes No
For free? Yes No — Talk with Salesforce
Storage It count against storage It doesn’t count against storage

Después de dreamOlé ’17

Y después de tanto preparativo llegó el día y pasó igual de rápido que un día de Reyes.

Laura ya había creado un flow impresionante así que todos sabíamos dónde teníamos que estar y qué hacer en cada minuto, pero aún así, corríamos de un lado para otro terminado de organizar los últimos detalles antes de que empezaran a llegar nuestros “invitados”.

2 horas más tarde de entrar por la puerta de OpenTalk, el equipo comenzaba el evento y presentaba a nuestra oradora principal Erica Kuhl que nos habló sobre la familia de Salesforce y el importante significado de palabras como Comunidad, Ohana, Trailblaizer, etc.

Estamos a la espera de la encuesta de satisfacción del evento, pero muchos de los asistentes nos dieron la enhorabuena por las sesiones. Variadas, interesantes, en ambos idiomas … pero en realidad el agradecimiento es para nuestros ponentes que hicieron un trabajo excelente sabiendo sortear contratiempos como los problemas de red que tuvimos e incluso un corte de luz!! Mil perdones a todos por estos fallos.

También teníamos un rinconcito para preguntar a los expertos con nuestro #WTFAQ

Captura de pantalla 2017-06-04 a las 21.54.53

Gracias Inés por la foto @Inescapinezka

Joshua y Julio hicieron un trabajo excelente y divertido presentando a los participantes de la DemoJam que finalmente ganó nuestro sponsor Copado. Enhorabuena!!

Y hablando de sponsors, volver a remarcar que todo esto no hubiera sido posible sin el apoyo de ellos. Gracias por creer en nosotros y lanzaros al vacío patrocinando un evento pionero en España y que nadie conocía.

Captura de pantalla 2017-06-04 a las 21.48.28

Nuestro amigo Eugenio Roldán cerró el evento hablando sobre Certificaciones y es que tuvimos la gran suerte de contar con él, primer Technical Architect Certified en España. Intentaré seguir tus consejos aunque estoy viendo que este examen es como sacarte unas oposiciones así que me temo que cuando lo tenga, ya habrá menos astronautas que certificados.

Y finalmente After-Party!! Más comida y bebida (la sangria riquísima) foto-matón (si, era el de First Dates!!) música, risas. Era el momento en que el relax llegaba al equipo y por fin podíamos disfrutar del día.

Captura de pantalla 2017-06-04 a las 21.54.30

Gracias J-Michel por la foto @jmmougeolle

Inés, Laura, Carlos, Julio, Yasmina, Roger, Alba, Carolina, ha sido un verdadero placer trabajar con vosotros durante estos últimos 9 meses – dreamOlé adictos!!

Y el año que viene más y mejor!!! – Sigue dreamOlé en twitter y se el primero en enterarte cuando abrimos el “speakers submission”, y el registro para no quedarte sin tú entrada.

London’s Calling ’17 and Visual Flow

Last 10th of February, I attended London’s Calling ’17 and I can say it was a great and funny day.

Captura de pantalla 2017-03-12 a las 19.22.17

And obviously, we had lot of opportunities to learn more about Salesforce. Actually I had the chance to run a session about Visual Flow where I got nice questions that I promised to review and answer, and here is the time for it:

1. Did you find any issue related to Communities?

When I created a new Community in my org and tried to add elements, I was not able to find the Flow Lightning Component that allows me to include visualflows in Lightning Experience. However, I can add visualforce pages, so if you have your flow embebed in a visualforce page and you set this page up to be used in Communities, then, it seems you can see your flow in the Community.

2. Did you find any issue during deployment?

Although my daily job tasks do not include deploying flows, I could say that those times that I tried I did not get any special issue to highlight. We just need to keep in mind few things, like also include those objects that flow references but this is like some other components. In addition, although in your org you have several versions, in change set you can only include the latest active one. And as I said in the session, in order to include a flow in package, it should be active, otherwise, it will not appear as an element to be included. You can find more information here.

3. What is coming in Spring ’17 release?

I talked about some Spring’17 features, but I also promised to review, the new FLS feature. But let start checking the behaviour if I do not have access to the object itself.

So having a user which profile only allows to Read and View All reservations:

Captura de pantalla 2017-03-12 a las 11.11.03.png

if I try to run the BookingSystem application, by the time I try to save the Reservation, I get an unhandled error (that’s why Salesforce encourage to cover these in the same way we do in apex) And the administrator receives an email with the log and the error:

Captura de pantalla 2017-03-12 a las 11.14.24Captura de pantalla 2017-03-12 a las 11.15.04

Let’s double check new FLS for Flow in Spring’17

Captura de pantalla 2017-03-12 a las 12.06.57

In this scenario, I have Filter Inaccessible Fields from Flow Request enabled in Process Automation Settings, and also, I have defined a Field Level Security of No Visible for Facility Price in my custom profile

Captura de pantalla 2017-03-12 a las 11.28.42.png

So, having this configuration, I have created also this flow in order to insert a new Facility via a Fast Create screen

Captura de pantalla 2017-03-12 a las 19.01.51.png

So in order to do that, I create a SObject and I use the input fields from the first screen in order to make an assignment to the SObject fields and finally pass the SObject to the Fast Create

Now, if I run the flow with the profile that doesn’t have price visibility, I can create a new record, but having an empty price.

Captura de pantalla 2017-03-12 a las 19.11.19.png

However, if I disable Filter Inaccessible Fields from Flow Request enabled in Process Automation Settings, and run the flow again, the result is different. The record is not half created and the administrator receives and email with the error.

So now, what should I do? Up to you really. You can handle the exception and provide a nice error message and don’t allow the end user to create a Facility record without the prices. However, if the field is not required for the business, you can leave this half creation.

Any other question about Visual Flow? Leave it as a comment and I will try to check it and reply you.

 

 

dreamOlé ’17 – De la Comunidad para la Comunidad

Hace un año Carolina habló conmigo para organizar algo como London’s Calling pero en España. Al principio me pareció una idea un poco descabellada. Salesforce no tiene tanto tirón ahora mismo en nuestro país, pero precisamente por eso poco a poco se convirtió en una gran idea. Y aquí estamos Inés, Laura, Carlos, Julio, Yasmina, Roger, Alba, Carolina y yo quedando 2 veces por semana a las 8am para hablar de nuestro proyecto: dreamOlé.

Os puedo asegurar que nos costó mucho trabajo decidir los puntos principales:

El nombre – ¿Por qué dreamOlé?

Buscábamos algo que tuviera tirón, alguna canción como en Londres, pero “Aquí no playa vaya vaya” no nos parecía lo ideal. Así que pensamos en una combinación de algo típico español, feria, fiesta, sol, tapas, paella … pero sin ser topicazo. Y añadir la palabra dream cómo otros eventos similares. Y tras varias votaciones … nos quedamos con dreamOlé.

El lugar – OpenTalk – Madrid

Para nuestro primer evento, decidimos ir a lo seguro, Madrid ó Barcelona ya que hay una gran red de empresas relacionadas con Salesforce y podríamos tener público. Y finalmente nos decantamos por la capital de España. Y a partir de ahí a buscar el local. De verdad, no sabía que era tan complicado que incluso te cojan el teléfono … pero finalmente encontramos el lugar ideal para nuestro primer evento. Gracias OpenTalk !!

La fecha – 1 de Junio de 2017

Los primeros 6 meses del año son complicados. Hay muchos eventos de Salesforce por Europa, incluyendo el Essentials de Madrid y Barcelona. Así que buscamos un mes bonito en Madrid y rezamos para que no coincidiera con otras charlas, ya que algunos se anuncian con poca antelación.

¡Necesitamos un Logo!

Y echamos mano de nuestro compañero Jorge para este diseño. Fue verlo y enamorarme.

dreamOle-light@2x

 

La Agenda

No iba a ser un evento distinto a otros ya celebrados. Queremos acercar Salesforce a la comunidad, por eso nos centraremos en proporcionar sesiones donde compartir conocimientos. Estamos trabando para ofrecer charlas en inglés y español y sobre temas actuales, y por supuesto dirigidos a distintos públicos: Desarrolladores, Administradores, Usuarios finales …

Por otro lado, somos una organización sin ánimo de lucro organizando un evento que cuesta dinero, por lo que necesitamos la ayuda de patrocinadores para llevarlo a cabo. Para ello los sponsors Platinum y Gold tendrán un stand durante todo el día para promocionarse. Y además organizaremos un DemoJam dónde los sponsor Platinum tendrán 3 minutos para mostrar su producto ante todos los asistentes ya que no coincidirá con ninguna charla. Y al final habrá un ganador!!

Y por supuesto, tendremos un KeyNote inicial y final. Seguimos dando la lata a toda persona conocida en este mundillo para que venga y por ahora hemos convencido a Erica Kuhl, así que yo no me la perdería.

Y a partir de ahí seguimos trabajando para que todo esté listo a tiempo

¿Quieres saber más?  Síguenos en twitter ó Visita nuestra web. Y no te olvides. ¿Quieres ser sponsor? No te lo pienses porque tenemos plazas limitadas. Encuentra toda la información aquí.

¿Te gustaría dar una charla y compartir tus conocimientos? Mándanos tus ideas a través del Speaker Submission form y recuerda que la fecha límite es el 21 de Abril.

¿Tienes dudas? Visita nuestra sección FAQ y si algo no queda claro, ponte en contacto con nosotros a través de twitter ó el correo comunidadsalesforce@gmail.com

Nos vemos!!

Logo-O (1)

De Dev 401 a App Builder Salesforce Certificación

This blog is written in Spanish but if you are looking for a place with information about App Builder Transition exam, go to Link section

Hace algunos años conseguí mi primera certificación – Salesforce Force.com Developer, también conocida como Dev 401. Así que cuando supe que ya no estaba disponible y (peor aún) que en breve dejaría de tener validez, casi me echo a llorar. Pero Salesforce nos ofrece una forma de conseguir una certificación equivalente, App Builder, de forma sencilla mediante un examen de transición.

Captura de pantalla 2017-03-10 a las 12.11.07

¿Cómo es este examen de transición?

Tienes 30 minutos para contestar 20 preguntas tipo test dónde la respuesta puede ser 1 ó varias opciones. Debes tener en cuenta que para conseguirlo necesitas una puntuación del 65%. 

Como en otros exámenes, puedes hacerlo en una localización de Salesforce, ó en casa vigilado por el programa Centinela.

Si sólo tienes esta certificación, el examen de transición es gratuito para ti. Bueno, eso creo. Yo tenía Dev 501 y mi transición para el Platform Developer I & II fue gratuito. Sin embargo para éste tuve que pagar los 100USD reglamentarios. Por eso creo que Salesforce te deja un examen de transición gratuito. Y tienes 3 oportunidades para aprobar. Si no lo consigues, volver a intentarlo cuesta 50USD.

 

¿Consejos para estudiar?

Via webassessor puedes registrarte y bajarte el material de referencia dónde encontrarás los puntos más importantes y conocimientos que se esperan para esta certificación.

Captura de pantalla 2017-03-10 a las 12.29.50.png

La verdad es que este examen me ha resultado más fácil ya que para el transition del Platform Developer I & II la guía te pedía que estudiaras lo mismo que para los dos exámenes así que le dediqué muchísimo tiempo.

En esta ocasión con los enlaces de la imagen de arriba (no he puesto los enlaces directamente por si de una versión a otra cambia algo. Ve a la guía y revísalo) y alguna información extra encontrada en blogs, tuve más que de sobra.

Soy de la vieja escuela, así que después de imprimir el material y subrayarlo, dedicaba 1 ó 2 horas al día a repasar la teoría y hacer alguno de los mocks exam que encontré por la red (más abajo tienes los enlaces)

El día del examen

La vin compae qué complicado es hacerte la foto para empezar el examen. Entre lo blanca que soy y que milagrosamente era un día bastante soleado en Bilbao, mi cara tenía bastante luz y nada, no había forma. 

Esta anécdota es sólo para recordarte que prepares el sitio del examen con antelación. Cuando te registras te llegará un email con información sobre los requisitos de software y hardware necesarios para el examen. Y aun así, si tienes problemas después de lanzar el examen, respira hondo que al final lo conseguirás.

Tardé unos 15 minutos en pasar todas las preguntas, por lo que tuve 10 más para una segunda vuelta, y 5 para aquellas preguntas con las que tuve más dudas. Pero en principio tienes tiempo suficiente.

Encontré preguntas sobre:

  • Record Types
  • Tipos de relaciones entre objectos
  • External Objects
  • Cambios de tipo de campos. Por ejemplo, ¿se puede de currency a number sin perder información?
  • Field Updates
  • Orden de ejecución de triggers. En realidad eran preguntas relacionadas con field updates pero que si sabes el orden de ejecución de los triggers, puedes responderla sin problemas.

Últimos consejos

Asegúrate de estudiar con el material de la release para la que te vas a examinar. De una a otra no suele cambiar demasiado, pero por si acaso.

Intenta usar cable de red en vez de wifi. Cualquier corte inesperado puede parte el examen … qué gracia.

Apaga el móvil. La vibración también distrae.

Respira hondo. Si yo lo he conseguido tu también.

Si has visto en alguna web que por un precio simbólico te ofrecen más exámenes de prueba, sinceramente creo que para este examen no es necesario pero seguro que también es útil.

Links

Este es el material que revisé además de el proporcionado por la guía.

¡Aviso a navegantes! Intenta descargar de alguna manera los mocks exams ya que durante mis dos semana de estudio, algunos enlaces dejaron de funcionar.

Mi guía de estudio pero usa la última versión via webassessor.

Flash cards ¡muy útiles!

Más Flash cards pero más orientadas al examen App Builder que al Transition.

Sample Questions

Blog y blog Información extra interesante.

¡Suerte!

 

My First Lightning Component on Utility Bar via Eclipse

Note: I wrote this post in October 2016 but didn’t publish it because I was getting issues trying to making Eclipse work. However, after few months and do not find a solution, I decided to publish what I wrote. Maybe first steps could help others. An if you have the answer to my issue, I would really appreciate your help.

In addition I have included a super simple Lightning Component and how to integrate in the new Utility Bar that Spring ’17 bring to us.

When you develop some code, which is the tool you use for it? If you have never created some complex line of code, maybe you think that Developer Console allows you to do what you need. However, if your daily basis is programming, you need a tool outside of the org for that.

Nowadays I use Mavensmate, but on my early days I was an Eclipse fan, so when I knew that there is a beta version of Force.com IDE in order to create Lightning Components, I decided I had to check it. And this post is about it. Well, more about how to install it, as well as create a super simple Lightning Component.

First of all, I tried to open my Eclipse and create a project againts my org. But I got this error:

captura-de-pantalla-2016-10-08-a-las-12-18-48

Oh my God!! It’s true that long time ago since I don’t open Eclipse (Juno in my case) !!! So first of all, fix it. How? Here there is a link that explain you about this Salesforce change, but here is what I did on my Mac.

  1. Run java -version on cmd — old version as well !! So via System Preferences, click on Java icon and updated the version to 8 one there. And also download latest JDK.

Now java -version returned to me 8 one. So I tried again and this time it worked.

However I tried to install Force.com IDE for lightning and I got an error, so checked more instructions and I found this article and I realized that my version was older than 4.5, so decided to download a newer version. If this is not your case, jump next section

How to install eclipse

From here you can download latest Eclipse version (be sure you get it for Mac or PC depending on your machine OS). Well, actually you download an installer. When I executed it, I got an error message, so after looking at several blogs, like this one, I realized that I had to update the installer via the top right coner icon.

captura-de-pantalla-2016-11-11-a-las-14-20-53

Then just select Eclipse IDE for Java Developers and click on install. Again I got an error with Neon, so I decided to try with another Product which version is higher than 4.5, so I chose Mars

Captura de pantalla 2016-11-22 a las 17.16.09.png

How to install Force.com IDE

The installation is quite straight forward, you just need to follow below steps (find also the information here)

  1. In Eclipse, click Help > Install New Software.
  2. Add this new update site: https://developer.salesforce.com/media/force-ide/beta_eclipse45
  3. Be sure that Group items by category checkbox is not selected.
  4. Select the checkbox next to Force.com IDE (required).
  5. If you have Apex Debugger licenses, select the checkbox next to Force.com IDE Debugger.
  6. Select the checkbox next to Force.com Lightning Support
  7. Click Next and start the installation.

20170203 Note There is new link to Eclipse IDE because it is no beta anymore as well as you can also find more information on Salesforce page as well. I tried with them as well, but no luck, still does not work.

How to work with Eclipse

Now you can create the project as usual, but you will realize that the folder structure looks different. It also have the aura folder. If we want to add / create the aura element we will find the entry as well.

How to create a Lightning Component

As you can find lot of information related to Lightning Components creation (including Trailheads) I will not explain in deep what it is a Lightning Component and how to create it. Just show you how you can develop something super simple in Eclipse.

Use Case – Employee List

I have a custom object, Employee, in my organization

Captura de pantalla 2016-11-23 a las 10.49.10.png

And I would like to create a Lightning Component that list all my Employees and be able to insert on the Home tab, for instance.

20170203 Note: I was not able to make Eclipse work, so this code has been developed in Salesforce Developer Console. Do you want me to help anyhow and get some credits? Find my question on stackExchange as well as Developer Forums

Super simple Employee List Lightning component

I will create 2 component.

The first one will just show the FirstName and Surname of an Employee

<!-- EmployeeListItem -->
<aura:component>
    <aura:attribute name="employee" type="Employee__c"/>
    <li>{!v.employee.FirstName__c}{!v.employee.Surname__c}</li>
</aura:component>

And the second one will iterate over a list of Employees and make calls to the above component in order to show the information.

<!-- EmployeeList -->
<aura:component controller="EmployeeController" 
                implements="flexipage:availableForAllPageTypes">
    <aura:attribute name="employees" type="Employee__c[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <h3>Employees</h3>
    <aura:iteration items="{!v.employees}" var="empl">
       <c:EmployeeListItem employee="{!empl}"/>
    </aura:iteration>
</aura:component>

But for that, it needs to retrieve the information somehow. That’s why we have the reference to the server side controller EmployeeController.

/**
* @agarciaodeian
**/

public with sharing class EmployeeController
{
    @AuraEnabled
    public static List<Employee__c> getEmployees()
    {
        List<Employee__c> listRetrieved = new List<Employee__c>();        
        if(Schema.sObjectType.Employee__c.isAccessible())
        {
               listRetrieved = [SELECT Id, Name, FirstName__c, 
                                       Role__c, Surname__c 
                                FROM Employee__c];
        }
        return listRetrieved;
    }
}

Finally, in order to get the result, in the EmployeeList we execute the action that initialize the list of employees making a call to the JavaScript controller

({
    doInit : function(component, event) {
       var action = component.get("c.getEmployees");
       action.setCallback(this, function(a) {
          component.set("v.employees", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})

Once I have the code in the organization, I can create a project on Eclipse and I would see my components under the aura folder

captura-de-pantalla-2017-02-04-a-las-11-42-36

If I open EmployeeList, for instance, I can see also the EmployeeListController.js tab as well. So it is easier and it is sorter than in the Developer Console.

How to add my Lightning Component to the Utility Bar

captura-de-pantalla-2017-02-04-a-las-11-57-11

 

 

 

Once I have the Lighting Component, I can show the result in the Home page tab for instance

 

 

 

And now that Spring ’17 is arriving, we can include also our lighting components into the Utility Bar. Previously we had to create it via metadata and deploy but now it’s a matter of point and clicks.

Go to App Manager and edit your app. Now, one of its steps is the Utility Bar  and after clicking on Add button you can find same Lightning Components than in the App Builder.

captura-de-pantalla-2017-02-04-a-las-15-32-54

For instance, standard like Flow (Beta), Manage, and Custom. So I select my custom lighting Component Employee List.

And … that’s all!! Now I have my super simple LC in the Utility Bar, so that I can see the list of all Employees from everywhere, including Salesforce Setup page.

captura-de-pantalla-2017-02-04-a-las-15-36-51

Lightning Experience and Visual Flow

Today I’m going to do some researches with one of these #clicksnotcode features that Salesforce provides in the Platform, Visual Flow. Ok, this is not a hot topic now, but if we want to check how it works in Lightning Experience (LEX from now onwards) then, this post could be a bit more interesting for you.

Take into account that Visual Flow in LEX is in beta

The use case it’s simple. I have a Hotel, and I would like to get some feedback from my guests, so I will send them a survey.

The Flow would be very simple, and as the creation is not the main goal here, I will not show it step by step. But if you are new, double check Visual Flow documentation and also TrailHead.

First of all we need to open Flow Designer, so, can I do it in LEX? Yes. Go to Setup and just write “flow” in order to find it and be able to open this platform feature.

captura-de-pantalla-2016-12-02-a-las-10-35-11

As you can see on below image, the Flow Designer looks like the Classic UI one, so you would not need to learn how to work with it if you already used it.

captura-de-pantalla-2016-12-02-a-las-12-08-29

Once I have created my Flow, we can add it to our Home page, but remember to Activate it, otherwise it would not be available in Lightning App Builder.

So, go to Home, Edit this page, and Lightning App Builder will help you to add it there.

How? Really simple, if you go to Standard Apps, one of them is Flow (beta) so you only need to click on it, and your flow will appear in the home page.

captura-de-pantalla-2016-12-02-a-las-10-57-11

But actually I have 2 active flows, so what can I do? When you highlight your custom Flow, on the right side you have the option to select the one you need to show, so just pick one.

captura-de-pantalla-2016-12-02-a-las-11-12-38

I can also say that I had to try a couple of times till I got this behavior. First time, Book Room flow did not appear on the drop down list, so there were not way to add it to my Home page. But remember, this feature is on beta, so be patience and try till you get it.

Last thing to mention is the fact that you can chose between 1 or 2 columns. My first thought was that this attribute would help me to determine if I wanted 2 flows on the same row on the page layout, but it is not related to that. It just help you to set all your flow fields in 2 columns instead of one. For instance, these 2 screens show same fields but they are sorted in a different way.

captura-de-pantalla-2016-12-02-a-las-12-11-41captura-de-pantalla-2016-12-02-a-las-12-11-08

And how it works? In Spanish we say better a image rather than thousand words but in this case, better a video rather than thousand images.

 

Maybe your last question is if we can add it to any other place? Yes, for instance, I can include it in my Guest record layout

captura-de-pantalla-2016-12-02-a-las-13-06-23

But let’s make up a little bit and define something for every guest:

captura-de-pantalla-2016-12-04-a-las-20-20-05

In order to do that, I had to add a Lookup step in the Flow and use the variable {!recordId} as a filter. So that, I can retrieve Guest object record and use it in my Flow.

captura-de-pantalla-2016-12-04-a-las-20-26-44

It was not easy to find the way to retrieve the recordId but this post helped me a lot.

I hope you liked this short entry about Flow. You can find more information on Salesforce release notes entry.