AlbaniaDreamin24 - How to easily use an API with Flows

ThierryTROUIN 78 views 50 slides Apr 26, 2024
Slide 1
Slide 1 of 50
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50

About This Presentation

Albanian Dreamin a Community Powered Conference to activate, empower and strengthen the Salesforce potential through assistance, education, networking and knowledge sharing to improve the workforce and professionalism in Albania.


Slide Content

How to easily use an API with Flows

Karine IOST Salesforce enthusiast since 2020 Salesforce Consultant at Accenture Fundation Admin certified Volunteer at French Touch Dreamin 2022 2023

Thierry TROUIN Salesforce Architect at Orange Business 13 years old on Salesforce ecosystem 10 Salesforce Certifications + 3 partners Certifications Group Leader at Toulouse Salesforce User Group Certified Instructor (Salesforce Administrator ) Salesforce MVP since 2021 French Touch Dreamin Co-Organiser Speaker on Salesforce Events x3 x2 x5

Agenda Definition Uses Case Tools and Features Setup Conclusion

Definition

Definition API = A pplication P rogramming I nterface API is a way for two or more programs or components to communicate with each other . It is a software interface , offering a service to other software . API Request Request Response Response Client / Application Base de données

Use Case

Use Case Some examples of API use Today ’s or week’s weather List of public holidays for the current year Automatically update an exchange rate L ist of city in an area Official bulletin of civil and commercial announcements

Use Case Our company has a needs : Retrieve the public holidays in France for the year 2024 .

Use Case How can I answer it ? Our company has a needs : Retrieve the public holidays in France for the year 2024 .

Use Case How can I answer it ? The site «  https://api.gouv.fr  » offers us a free API listing public holidays. Our company has a needs : Retrieve the public holidays in France for the year 2024 .

Tools & Features

Tools & Features Tools : https://swagger.io https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com

Tools & Features Tool s : Salesforce Features : https://swagger.io https://api.gouv.fr/documentation/jours-feries https://www.salesforce.com Named Credentials Flows (screen) External Services Remote Site Settings

Setup

Setup - Identify our API Access the URL «  https://api.gouv.fr/documentation/jours-feries  » to view the API documentation I chose an API

Setup - Identify our API Access the URL «  https://api.gouv.fr/documentation/jours-feries  » to view the API documentation Here the API URL

Setup – Set connection Add the Url « https://calendrier.api.gouv.fr  » into the list of «  Remote Site Settings  » List of authorized sites from Salesforce

Setup – Set connection Click the «  New Legacy   » button to set the API connection in Salesforce

Setup – Set connection Enter the «  Name  » and «  URL  » https://calendrier.api.gouv.fr that corresponds to the API

Setup – Load API Click the «  Add an External Service  » button to add the API schema.

Setup – Load API Select «  From API Specification »

Setup – Load API Enter the information

I have an error about the format Setup – Load API Enter the information

Setup – Load API Enter the information The schema provided by the site (YAML) is not compatible with Salesforce (JSON) You must use a conversion tool (swagger)

Setup – Load API Let’s go to the swagger site « https://swagger.io/  »

Setup – Load API Click on the link to view the communication schema https://api.gouv.fr/documentation/jours-feries API Schema

Setup – Load API Click on the « File » menu Click on the « Import URL » menu Paste the API URL «  https://calendrier.api.gouv.fr/jours-feries/openapi.yml  »

Setup – Load API Click on the « File » menu Click on the «  Convert and save as JSON » menu The file is automatically saved on our PC

Setup – Load API Select «  Upload from local » Click on the «  Upload Files » button

Setup – Load API Select « Upload from local » Click on the « Upload Files » button

Setup – Load API Select the operation (s)

Setup – Load API Click on the « Finish » button to save the «  External Service » Summary of Operations in the external service

Setup – Load API Well done, you have configured your service.

Setup – Designing the Screen Flow In Setup Click on the « Flows » menu Click on the « New Flow » button Select « Screen Flow »

Setup – Designing the Screen Flow Step 1 : Add the Screen component Get the current year

Setup – Designing the Screen Flow Add the «  Number  » component to input the year Click on «  Defaut Value » then click on « New Resource »

Setup – Designing the Screen Flow Creating a resource to get the current year by default Input the name «  ThisYear  » Select the data type «  Number  » without decimal Use the function TODAY() to retrieve the today’s date Use the function YEAR() retrieve only the year of our date YEAR( TODAY() )

Setup – Designing the Screen Flow The 1 st form is created

Setup – Designing the Screen Flow Step 2 : Add the « Action » component Retrieving public holidays

Setup – Designing the Screen Flow Add an action In menu, select «  JourFeries  » Click on «  getZoneAndAnnee  » Name of our External Service Created just before Public holiday ’s recovery function name

Setup – Designing the Screen Flow Input the action « Label » Select the «  txtAnnee  » corresponding to the text box of the 1 st form Create the « Zone » constante with «  metropole  » value

Setup – Designing the Screen Flow Step 3 : Add a « Screen » component The result screen

Setup – Designing the Screen Flow Add the « Display Text  » component and name it «  txtResultat  » In the « Resource Picker  » area Click on « Outputs from GetJoursFeries  » Click on « 200 » ( which corresponds to our result ) Delete the point « . » at the end of the « {!GetJoursFeries.200} » variable

Setup – Designing the Screen Flow The 1 st screen shows the current year The 2 nd screen shows the result

Conclusion

Conclusion Steps Action Comments Step 1 Identify our API https://api.gouv.fr/documentation/jours-feries Step 2 Set connection into Salesforce Remote site + Named Credential Step 3 Load API into Salesforce External Services (+ swagger) Step 4 Designing the Screen Flow Flow

Download me here https://bit.ly/albania-api-flow