Salesforce introduced a new feature in its Spring 23 release to make HTTP callout from Flow which is in beta version and after the Winter' 24 release its full version was released and is available with all the Http methods. This update enables the Salesforce flows to directly communicate with external web services through Api which is very useful for administrators.
In this blog, I will create a translation process of texts in four languages simultaneously using flow Http Callout. This is how the flow will look as the result.
What is an Http Callout?
An HTTP callout term is commonly used to describe the process of requesting a remote web server over the HTTP (Hypertext Transfer Protocol) protocol. It is commonly used in web development and software applications to interact with APIs, access external services, exchange information between systems, retrieve data from a web service, send data to a web service, or interact with a remote server.
Types of Http Callout Methods:
GET
POST
PUT
PATCH
DELETE
Key Points to be considered before going through the Flow for Authenticating HTTP Callout Actions.
External Credentials that define the authentication.
It is used to authenticate the external service. It's like having a key to access and communicate with external systems while maintaining security and authentication.
External credentials authenticate users, and permission sets authorize users.
External Credential Principal is necessary to create without it we cannot map the external credential to any permission set.
Named Credentials.
Named Credentials are a secure and efficient means to authenticate and manage external services or APIs within the Salesforce ecosystem.
Used to store the URL for the external system so that whenever we are making a callout salesforce easily understands that it's a valid URL.
Create a Permission set.
Map the permission set with the external credentials and assign it to the users who can make the callout.
In this blog, I am going to tell you a step-by-step process to make an HTTP callout using flow.
Step 1: Create External credential
Salesforce Setup → In Quick Find search “Named Credentials” → next to the Named Credential Tab there are external credentials → click New
Provide a Label, Name For your External Credential and choose “custom” as an Authentication Protocol
Step 2: Create an External Credential Principal
Step 3: Create a Named Credential
Step 4: Create the Required Custom Header to the Named Credential.
Custom headers are a way for a remote system to define parameters it needs as input to respond to a request.
Step 5: Create a Permission set and map to the External Credential Principal Access
Select the Permission set-> then click on “External Credential Principal Access”
Select the External Credential Principal and add.
Then click on “Manage Assignments” to assign that permission set to a specific user whom you allow to make a callout.
Step 6: Creating the salesforce flow
Salesforce Setup → In Quick Find search “Flow” → click New Flow → create a Screen flow.
Screen component
Configure the New HTTP Callout Action and select the Named Credential that you just created.
Configure the HTTP Callout method. Select the method as POST. Set the URL endpoint and create the required parameters to pass while making the callout.
Provide sample API request or response body click on review and done.
Behind the screen, it creates a Dynamic Apex Class.name the action file and assign the required parameter values dynamically.
Create a decision element to show the response based on the response code.
Flow Debugging
Flow Testing
Now add the flow to the home page and check if the flow is working fine or not.
Conclusion
The release of HTTP callout in Salesforce transformed the way Salesforce interacts with external services. By removing the need for Apex classes for callouts, this update simplified the process, basically for admins to make HTTP callouts. The key points- Named Credential, External Credential, and Permission Set to ensure that these callouts are secure and efficient.
If you'd like to see the code and resources used in this project, you can access the repository on GitHub.To access the AVENOIRBLOGSrepository, click here. Feel free to explore the code and use it as a reference for your projects.
Thank you! You can leave a comment to help me understand how the blog helped you. If you need further assistance, please get in touch with us at Reach us. You can click "Reach Us" on the website and share the issue with me.
Reference
https://help.salesforce.com/s/articleView?id=sf.flow_http_callout.htm&type=5
https://help.salesforce.com/s/articleView?id=sf.flow_http_callout_considerations.htm&type=5
https://help.salesforce.com/s/articleView?id=sf.nc_named_creds_and_ext_creds.htm&type=5
https://help.salesforce.com/s/articleView?id=sf.flow_http_callout_configure.htm&type=5
Blog Credit:
A. Rawani
Salesforce Developer
Avenoir Technologies Pvt. Ltd.
Reach us: team@avenoir.ai
Are you in need of Salesforce Developers?
Reach Us Now!
Comments