Brief Description: a Salesforce Lightning Web Component to search Yelp based on the current Account record's address
While researching API callouts using Apex I came across this YouTube video by the Salesforce Developers channel "Introduction to Callouts in Apex" and they did a demo of a LWC that connected to Yelp. It used the current record's address as the location when searching. This was so interesting and inspiring that I set out to build it myself. I also challenged myself to not use Apex and handle all the functionality in the JavaScript code.
If you plan to add to your org, be sure to add the CSP Trusted Site settings. Check out the screenshot for details.
- Create the css and visualization of individual item LWC
- Make api static data show as an array in the console
- Iterate through an already existing list of search results on LWC
- Move the visualization of iteration to separate component
- Search term is added to url and dynamic results shown
- Address is pulled from current page (may need to be a separate LWC since oauth error in org)
- Order results by distance & display that sorting as text
- Fix oauth error in org component (CSP setting in org)
- Clicking on result goes to the URL in a new tab
Introduction to Callouts in Apex: https://youtu.be/LSnfXHlSJEI?t=683
Lightning Web Component Crash Course: https://www.youtube.com/watch?v=bLyAsIeDZtw
Build a dashboard with Realtime API in Salesforce: https://www.youtube.com/watch?v=6MuvWRJCsK0
Sorting data: https://stackoverflow.com/questions/8175093/simple-function-to-sort-an-array-of-objects
Salesforce CSP Trusted Site Settings: https://developer.salesforce.com/blogs/2018/10/introducing-new-content-security-policy-options-for-lightning-communities.html
Salesforce Lightning Component Reference: https://developer.salesforce.com/docs/component-library/overview/components