<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tejas Bal</title>
    <description>The latest articles on DEV Community by Tejas Bal (@tejas87).</description>
    <link>https://dev.to/tejas87</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F872701%2F7d8fa706-191a-4170-81ae-bdaeb2c25291.png</url>
      <title>DEV Community: Tejas Bal</title>
      <link>https://dev.to/tejas87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tejas87"/>
    <language>en</language>
    <item>
      <title>Integrating Cryptocurrency Prices in Salesforce using Lightning Web Component (LWC)</title>
      <dc:creator>Tejas Bal</dc:creator>
      <pubDate>Sun, 05 Jun 2022 09:17:59 +0000</pubDate>
      <link>https://dev.to/tejas87/integrating-cryptocurrency-prices-in-salesforce-using-lightning-web-component-lwc-525d</link>
      <guid>https://dev.to/tejas87/integrating-cryptocurrency-prices-in-salesforce-using-lightning-web-component-lwc-525d</guid>
      <description>&lt;p&gt;In this article I will integrate live cryptocurrency prices in Salesforce developer instance, so let’s get started !&lt;/p&gt;

&lt;p&gt;I created a free account on &lt;a href="https://pro.coinmarketcap.com/login" rel="noopener noreferrer"&gt;CoinMarketCap&lt;/a&gt; to get an API key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1l38o4dgkbmup8rz5tb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1l38o4dgkbmup8rz5tb.png" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete documentation on how to use this api is provided &lt;a href="https://coinmarketcap.com/api/documentation/v1/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am using the &lt;a href="https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyListingsLatest" rel="noopener noreferrer"&gt;latest listings api&lt;/a&gt; to get the prices.&lt;/p&gt;

&lt;p&gt;URL&lt;br&gt;
&lt;a href="https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest" rel="noopener noreferrer"&gt;https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "data": [{
     "name": "Bitcoin",
     "symbol": "BTC",
     "quote": {
        "USD": { 
           "price": 9283.92,
           "percent_change_24h": 0.518894
        }
     }
   }]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Create a &lt;a href="https://developer.salesforce.com/signup" rel="noopener noreferrer"&gt;Free Salesforce Developer&lt;/a&gt; account.&lt;/p&gt;

&lt;p&gt;Create new Remote Site Settings entry for CoinMarketCap site url.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq0kolumqhbmmhn7fose.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq0kolumqhbmmhn7fose.png" alt="Image description" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/baltejas/CryptocurrencyPricesLWC/blob/main/force-app/main/default/lwc/crypto/crypto.js" rel="noopener noreferrer"&gt;Code&lt;/a&gt; to create the lightning web component&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The html is used to show the table with cryptocurrency prices.&lt;/li&gt;
&lt;li&gt;The javascript file is used to call the Apex class and store the prices for the view.&lt;/li&gt;
&lt;li&gt;The Apex class calls the CoinMarketCap to get the latest prices.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Deploy the code in your Salesforce Instance.&lt;/p&gt;

&lt;p&gt;Please refer &lt;a href="https://medium.com/@tejas.bal/integrating-cryptocurrency-prices-in-salesforce-using-lightning-web-component-lwc-752deb0fe93d#:~:text=Create%20a%20Hello%20World%20Lightning%20Web%20Component" rel="noopener noreferrer"&gt;Create a Hello World Lightning Web Component&lt;/a&gt; trailhead for more details on how to write code and deploy it to Salesforce instance.&lt;/p&gt;

&lt;p&gt;Let’s add our LWC component to the Contact Page.&lt;/p&gt;

&lt;p&gt;Go to an existing contact record and Click Edit Page on the top right.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fus4mbksa6ylyik6xsh2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fus4mbksa6ylyik6xsh2c.png" alt="Image description" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drag the custom component to the layout above Activity section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6aoaeo66p4bfawrfqkut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6aoaeo66p4bfawrfqkut.png" alt="Image description" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save and Activate.&lt;/p&gt;

&lt;p&gt;And all set, we have the Crypto Currency Live Prices in Salesforce !&lt;/p&gt;

&lt;p&gt;Refresh the contact record page to get updated prices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmppu0x5g0v6btb47ra6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmppu0x5g0v6btb47ra6.png" alt="Image description" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code can be optimized for better performance. &lt;a href="https://github.com/baltejas/CryptocurrencyPricesLWC" rel="noopener noreferrer"&gt;Github link &lt;/a&gt;to the repository in case you would like to reuse or contribute.&lt;/p&gt;

&lt;p&gt;Thanks for reading !&lt;/p&gt;

&lt;p&gt;Blog - &lt;a href="https://tejasbal.in/" rel="noopener noreferrer"&gt;https://tejasbal.in/&lt;/a&gt;&lt;br&gt;
Medium - &lt;a href="https://medium.com/@tejas.bal" rel="noopener noreferrer"&gt;https://medium.com/@tejas.bal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>lightningwebcomponents</category>
      <category>apex</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
