Dans ce guide je vais créer un composant Lightning avec un affichage sous forme de liste de détail lié à un contact. Les données alimentant la liste sont issues d’un service externe via une API REST.
Création du composant Lightning
La plupart des opérations vont se dérouler dans la Developer Console. Pour l’ouvrir il faut cliquer sur l’engrenage en haut à droite. Pour avoir accès à toute les possibilités du développement (accès webservice) il est indispensable d’effectuer le développement et les test dans une organisation sandbox. Salesforce n’autorise pas de développer directement sur l’organisation de production.
Petite aparté, pour pouvoir passer son code de la sandbox à la production, il faut impérativement disposer d’une couverture de code suffisante pour les classes APEX qui seront développées.
Dans la Developer Console, choisr le menu File->New-> Lightning Component :

Il faut saisir les informations souhaitées pour le nom du composant et les options souhaitées pour l’intégration du composant dans les éléments lightning. Une fois la création lancé, la Developer Console va changer l’affichage et proposer la liste des éléments indispensables et optionnels.
Création du Composant

Le premier élément, la partie component contiendra la présentation du composant sous un format HTML. Dans mon exemple il s’agit d’afficher la liste des mails envoyés depuis sendinblue. Je me suis basé sur l’aide de salesforce présentant le composant Datatable : https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example
Voici l’exemple de mon code :
Il faut noter dans la définition du composant aura, la partie controller. Cet élément défini pour la partie client le controller qui sera appelé en backend. Je vais donc avoir une classe SendinblueDataTableController qui retournerra une Liste de SendinblueAPIEvent (objet à définir également). Et recordIdContact contiendra l’ID du contact salesforce qui sera le paramètre passé à mon controller.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId"
access="global"
controller="SendinblueDataTableController" >
<aura:attribute name="data" type="SendinblueAPIEvent[]"/>
<aura:attribute name="columns" type="List"/>
<aura:attribute name="recordIdContact" type="String" default="{!v.recordId}"/>
<!-- handlers-->
<aura:handler name="init" value="{! this }" action="{! c.init }"/>
<!-- the container element determine the height of the datatable -->
<div style="height: 300 px">
<lightning:datatable
keyField="id"
data="{! v.data }"
columns="{! v.columns }"
hideCheckboxColumn="true"/>
</div>
</aura:component>
Ajout du Controller
Le controller contient le code logique qui sera exécuté côté client pour alimenter les données de la liste. Dans mon cas il s’agit uniquement de faire un appel à une API lors du chargement du composant. Le code ici est en javascript, il est possible comme je l’ai fait de mettre des éléments de débogage en utilisant le console.log qui affichera les messages dans la fenêtre console du navigateur.
({
init : function(component, event, helper) {
component.set('v.columns', [
{label: 'Sujet', fieldName: 'subject', type: 'text'},
{label: 'Date envoi', fieldName: 'date_Z', type: 'date'},
{label: 'Email', fieldName: 'email', type: 'text'}
]);
console.log("APPEL getEmailFromlAccount");
var action = component.get("c.getEmailFromAccount");
action.setParams({
contactId: component.get('v.recordIdContact')
});
action.setCallback(this, function(response) {
var state = response.getState();
var data = response.getReturnValue();
if(response.getState() == "SUCCESS"){
component.set('v.data', data);
}
});
$A.enqueueAction(action);
}
})
Dans les autres éléments constitutifs d’un composant, on peut créer un helper. Il permet de mettre à disposition des fonctions de formatage, ou de comportement sur les données du composants (tri par exemple.) Dans mon cas je n’en n’ai pas eu besoin.
Des élements de style, d’image et de documentation peuvent être ajouté.
Création de la classe controller APEX
A partir de là, le développement est orienté sur la partie serveur (backend). Le langage utilisé par Salesforce est APEX, qui est très proche du Java. Dans la Developer Console, choisir File -> New -> Apex Class.
public class SendinblueDataTableController {
@AuraEnabled
public static List<SendinblueAPIEvent> getEmailFromAccount(String contactId){
String email = '';
List<Contact> contacts = [select email from Contact where Id = :contactId];
if (contacts != null){
for(Contact c : contacts){
email = c.email;
}
} else {
email = 'test@scandevelopers.com';
}
List<SendinblueAPIEvent> sobj = new List<SendinblueAPIEvent>();
string strListEvent = SendinblueAPI.getListEmail(email);
SendinblueApexJson obj = SendinblueApexJson.parse(strListEvent);
if ((obj != null) && (obj.events != null)){
Integer i=0;
for (SendinblueApexJson.Events item : obj.events){
if (i< 5){
SendinblueAPIEvent apiEvent = new SendinblueAPIEvent();
apiEvent.email = item.email;
apiEvent.date_Z = item.date_Z;
apiEvent.subject = item.subject;
sobj.add(apiEvent);
}
i++;
}
}
return sobj;
}
}
La méthode qui sera accessible depuis le composant lightning doit être préfixé avec l’annotation @AuraEnabled. Dans l’exemple suivant, je vais chercher dans un premier temps à récupérer l’email du contact à partir de son ID passé en paramètre. Ensuite j’accède à l’API Sendinblue que j’ai encapsulé, et je ne récupère que les 5 premiers enregistrements.


39 Comments
Baixar WhatsApp para Iphone
28 juillet 2026 - 17 h 05 minI?ve read a few excellent stuff here. Definitely worth bookmarking for revisiting. I wonder how so much effort you put to make any such magnificent informative site.
Hollow butt plugs
29 juillet 2026 - 10 h 24 minHiya, I am really glad I have found this info. Nowadays bloggers publish only about gossips and internet and this is actually frustrating. A good blog with exciting content, this is what I need. Thank you for keeping this web site, I’ll be visiting it. Do you do newsletters? Can not find it.
viva88link
9 août 2026 - 17 h 52 minI?ve read a few good stuff here. Definitely price bookmarking for revisiting. I wonder how much effort you set to create this kind of great informative website.
viva88
10 août 2026 - 4 h 13 minExcellent web site. A lot of useful info here. I?m sending it to several pals ans additionally sharing in delicious. And obviously, thank you to your effort!
daman games app
13 août 2026 - 19 h 19 minGood write-up, I am normal visitor of one?s site, maintain up the nice operate, and It is going to be a regular visitor for a long time.
daman games app
14 août 2026 - 0 h 40 minWhat?s Happening i am new to this, I stumbled upon this I’ve found It absolutely useful and it has helped me out loads. I hope to contribute & help other users like its aided me. Great job.
daman
14 août 2026 - 12 h 01 minHey there! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog and look forward to new posts.
daman games app
15 août 2026 - 14 h 18 minThanks for this wonderful article. One other thing is that nearly all digital cameras can come equipped with a new zoom lens that allows more or less of any scene for being included by means of ‘zooming’ in and out. All these changes in {focus|focusing|concentration|target|the a**** length will be reflected inside the viewfinder and on big display screen on the back of the actual camera.
daman games app
15 août 2026 - 18 h 02 minThanks for your posting. One other thing is individual American states have their own laws in which affect property owners, which makes it very difficult for the our lawmakers to come up with the latest set of recommendations concerning property foreclosure on home owners. The problem is that a state provides own regulations which may have impact in an undesirable manner in regards to foreclosure plans.
daman game
15 août 2026 - 22 h 12 minI used to be very pleased to seek out this net-site.I wished to thanks to your time for this excellent read!! I undoubtedly enjoying every little little bit of it and I’ve you bookmarked to take a look at new stuff you weblog post.
klive
1 septembre 2026 - 11 h 16 minIt?s onerous to seek out knowledgeable folks on this topic, but you sound like you know what you?re talking about! Thanks
SEO Strategy Room
2 septembre 2026 - 9 h 01 minHeya are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any html coding knowledge to make your own blog? Any help would be greatly appreciated!
Haha
2 septembre 2026 - 18 h 22 minMany thanks for this article. I’d personally also like to say that it can possibly be hard if you are in school and merely starting out to initiate a long credit score. There are many students who are simply trying to pull through and have a long or favourable credit history is often a difficult element to have.
เว็บหวย
2 septembre 2026 - 19 h 03 minI like the valuable info you supply in your articles. I will bookmark your weblog and take a look at again here regularly. I am quite certain I will be told many new stuff proper here! Good luck for the following!
Haha
2 septembre 2026 - 19 h 40 minThat is the suitable weblog for anybody who needs to search out out about this topic. You notice a lot its almost onerous to argue with you (not that I truly would need?HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!
หี
3 septembre 2026 - 9 h 32 minWe are a gaggle of volunteers and opening a brand new scheme in our community. Your web site provided us with valuable information to work on. You’ve done an impressive activity and our whole group will be grateful to you.
Haha
3 septembre 2026 - 13 h 13 minYou should take part in a contest for among the finest blogs on the web. I will recommend this website!
สล็อต
3 septembre 2026 - 13 h 20 minI?m not positive where you’re getting your info, but good topic. I must spend a while learning much more or understanding more. Thanks for fantastic information I used to be in search of this information for my mission.
Haha
3 septembre 2026 - 14 h 12 minMy brother recommended I may like this blog. He was once entirely right. This put up truly made my day. You cann’t consider just how much time I had spent for this information! Thanks!
หี
3 septembre 2026 - 15 h 25 minHeya i?m for the first time here. I came across this board and I find It really useful & it helped me out much. I hope to give something back and aid others like you aided me.
สล็อต
3 septembre 2026 - 17 h 58 minHello! I could have sworn I’ve been to this blog before but after checking through some of the post I realized it’s new to me. Anyhow, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!
easyapplai
4 septembre 2026 - 16 h 19 minI have observed that in the world the present moment, video games include the latest popularity with kids of all ages. Occasionally it may be extremely hard to drag the kids away from the games. If you want the very best of both worlds, there are plenty of educational activities for kids. Thanks for your post.
www.easyapplai.com
4 septembre 2026 - 16 h 58 minMagnificent beat ! I wish to apprentice while you amend your web site, how could i subscribe for a blog web site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept
Easy Appl AI
4 septembre 2026 - 17 h 33 minI do enjoy the way you have presented this specific difficulty plus it does indeed present me personally a lot of fodder for thought. On the other hand, through just what I have experienced, I basically trust when the actual feedback pack on that people stay on issue and not embark upon a soap box of some other news of the day. Still, thank you for this outstanding point and while I do not really agree with it in totality, I regard your standpoint.
Roof Installation
6 septembre 2026 - 3 h 45 minHey would you mind letting me know which hosting company you’re working with? I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot faster then most. Can you suggest a good hosting provider at a honest price? Many thanks, I appreciate it!
Baixar WhatsApp para Iphone
6 septembre 2026 - 3 h 47 minI have taken note that of all sorts of insurance, medical care insurance is the most dubious because of the issue between the insurance policies company’s duty to remain profitable and the client’s need to have insurance. Insurance companies’ earnings on well being plans have become low, consequently some organizations struggle to make a profit. Thanks for the suggestions you reveal through this web site.
Roof Installation
6 septembre 2026 - 4 h 25 minI beloved up to you will obtain performed proper here. The sketch is tasteful, your authored subject matter stylish. nonetheless, you command get bought an nervousness over that you want be delivering the following. ill unquestionably come more until now again as precisely the same just about very often inside case you defend this increase.
Baixar WhatsApp para Android
6 septembre 2026 - 4 h 30 minThanks for your helpful post. Through the years, I have come to understand that the actual symptoms of mesothelioma cancer are caused by the actual build up connected fluid relating to the lining of your lung and the upper body cavity. The illness may start while in the chest spot and pass on to other areas of the body. Other symptoms of pleural mesothelioma cancer include fat loss, severe breathing trouble, throwing up, difficulty swallowing, and swelling of the face and neck areas. It needs to be noted that some people having the disease usually do not experience any kind of serious signs or symptoms at all.
Siding Installation
6 septembre 2026 - 5 h 04 minThanks for your article. One other thing is that often individual American states have their very own laws in which affect home owners, which makes it very hard for the the legislature to come up with a brand new set of recommendations concerning home foreclosure on householders. The problem is that every state possesses own legislation which may have interaction in a damaging manner on the subject of foreclosure policies.
Baixar WhatsApp para Android
6 septembre 2026 - 5 h 11 minI was just seeking this info for a while. After 6 hours of continuous Googleing, finally I got it in your web site. I wonder what is the lack of Google strategy that do not rank this kind of informative websites in top of the list. Normally the top web sites are full of garbage.
Baixar WhatsApp para Android
6 septembre 2026 - 14 h 05 minUsually I don’t read post on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, very nice post.
Baixar WhatsApp para Android
6 septembre 2026 - 14 h 32 minIt’s my belief that mesothelioma will be the most fatal cancer. It has unusual attributes. The more I look at it the greater I am confident it does not work like a real solid flesh cancer. If mesothelioma is a rogue viral infection, hence there is the possibility of developing a vaccine and offering vaccination for asbestos exposed people who are vulnerable to high risk connected with developing potential asbestos related malignancies. Thanks for giving your ideas for this important health issue.
Baixar WhatsApp para Iphone
6 septembre 2026 - 14 h 56 minThank you for the sensible critique. Me and my neighbor were just preparing to do a little research on this. We got a grab a book from our area library but I think I learned more clear from this post. I am very glad to see such wonderful information being shared freely out there.
Baixar WhatsApp para Iphone
6 septembre 2026 - 20 h 22 minThis web site is really a walk-by way of for the entire data you wanted about this and didn?t know who to ask. Glimpse here, and also you?ll undoubtedly uncover it.
Baixar WhatsApp para Iphone
6 septembre 2026 - 20 h 56 minPlease let me know if you’re looking for a author for your site. You have some really great posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to write some articles for your blog in exchange for a link back to mine. Please send me an email if interested. Cheers!
Baixar WhatsApp para Iphone
6 septembre 2026 - 21 h 28 minI like the valuable information you provide in your articles. I?ll bookmark your blog and check again here regularly. I am quite certain I?ll learn many new stuff right here! Good luck for the next!
CTO Migrations
7 septembre 2026 - 9 h 02 minHave you ever thought about creating an ebook or guest authoring on other blogs? I have a blog centered on the same information you discuss and would really like to have you share some stories/information. I know my viewers would appreciate your work. If you are even remotely interested, feel free to shoot me an email.
CTO Migration
7 septembre 2026 - 9 h 33 minI’m not sure why but this site is loading very slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later and see if the problem still exists.
kibris pavyon
8 septembre 2026 - 12 h 27 minHeya i am for the primary time here. I came across this board and I find It really helpful & it helped me out a lot. I am hoping to offer one thing back and aid others like you aided me.