<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Salesforce Analytics - Medium]]></title>
        <description><![CDATA[Weekly blog on the latest and greatest in Salesforce Analytics - Medium]]></description>
        <link>https://medium.com/salesforce-analytics?source=rss----dd19862cc160---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XMCJ5hwyB2ehNWGwhnmzjg.png</url>
            <title>Salesforce Analytics - Medium</title>
            <link>https://medium.com/salesforce-analytics?source=rss----dd19862cc160---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 04:59:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/salesforce-analytics" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Publishing Salesforce Analytics to Public Sites]]></title>
            <link>https://medium.com/salesforce-analytics/publishing-salesforce-analytics-to-public-sites-123d84272ccc?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/123d84272ccc</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Fri, 04 Jul 2014 22:22:33 GMT</pubDate>
            <atom:updated>2014-07-08T04:43:13.748Z</atom:updated>
            <content:encoded><![CDATA[<h4>Get going in just few minutes!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xbo5yjwgDxV6CrQLsRQUiQ.png" /></figure><p>In this blog post we will explore how easy it is to publish to your favorite metrics to a public site which could either be your internal portal/intranet or even a public facing website using the Analytics API.</p><p><strong>Please be careful with your data</strong>!</p><p>Here we are surfacing Salesforce data outside of the standard access model, so make sure to first test this out with a Developer org/Test data. When deploying “real” data, make sure the app is secured.</p><p>Live Demo: <a href="http://t.co/7GRKsRbvPF">http://bit.ly/TIwrn3</a></p><p>Source Code: <a href="https://github.com/arun-sfdc/Analytics-API/tree/master/PublicDashboard">https://github.com/arun-sfdc/Analytics-API/tree/master/PublicDashboard</a></p><p><strong>Step1: Identify your report and protect it</strong></p><p>The first is to identify a report that is aggregating your key metrics. Since this is going to be broardcast to a broader audience, make sure that it is in a read-only folder and surfaces only the right metrics. In my Node.js app, I use the awesome <a href="http://jsforce.github.io/">JSForce</a> library to connect to Salesforce and the Analytics API. For simplicity purposes, I use a username/password based login but more advanced and secure methods that should be considered for a production deployment.</p><p><strong>Step2: Launching the Demo App</strong></p><p>There are numerous deployment options when it comes to Node.js — local workstation, on-premise service or on the cloud. Our very own Heroku is one of the most popular deployment options you might want to consider. <a href="http://www.docker.com/">Docker</a> is a new open source tool that make the entire deployment process hassle-free . I wanted to try it out with a test application, so I have bundled this as a docker container here: <a href="https://registry.hub.docker.com/u/dockerhubtrial/analyticsapi/">https://registry.hub.docker.com/u/dockerhubtrial/analyticsapi/</a></p><p><strong>Option a: Private Deploy locally with NodeJS</strong></p><p>Here are the steps if you are using Mac or Linux:</p><ol><li>Download and install — git, nodejs and npm</li><li>Make a new directory and open it — mkdir dev2 and cd dev2</li><li>Get the code — git clone <a href="https://github.com/arun-sfdc/Analytics-API">https://github.com/arun-sfdc/Analytics-API</a></li><li>Open source directory — cd Analytics-API/PublicDashboard/src</li><li>Download dependencies — npm install</li><li>Move one level up in directory — cd ..</li><li>Start the App — node src/index.js</li><li>Showtime! Point your browser to <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></li></ol><p><strong>Option b: Public Deploy with Docker container</strong></p><p>If you have a Docker VM locally or an account with a Docker hosting platform feel free to skip the first step. Here’s are the steps to try it out, <strong>make sure you are using your demo data from a test login </strong>since this will be a public site:</p><ol><li>Signup for a account at a hosting site like <a href="https://www.tutum.co/">https://www.tutum.co/</a> (They have a free trial going on now).</li><li>Launch new application -&gt; Public Images</li><li>Search “analyticsapi” and select this “dockerhubtrial/analyticsapi”</li><li>Go to Environment variables and add the following: SFDC_USERNAME, SFDC_PASSWORD, SFDC_URL, SFDC_REPORTID</li><li><strong>REMEMBER TO USE YOUR TEST LOGIN WITH FAKE DATA.</strong></li><li>Hit Launch, wait for the app to start.</li><li>Click on container name “analyticsapi”</li><li>Click on instance name “analyticsapi-1”</li><li>Click on URL — looks like <a href="http://analyticsapi-1-tutum-trial2.delta.tutum.io:49165/">http://analyticsapi-1-tutum-trial2.delta.tutum.io:49165/</a></li></ol><p>That’s it, in under 5 minutes you have hosted your Salesforce Analytics into a Public Site!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=123d84272ccc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/publishing-salesforce-analytics-to-public-sites-123d84272ccc">Publishing Salesforce Analytics to Public Sites</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Scorecards with Salesforce1]]></title>
            <link>https://medium.com/salesforce-analytics/mobile-scorecards-with-salesforce1-e741043b5ee8?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/e741043b5ee8</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Tue, 13 May 2014 21:16:57 GMT</pubDate>
            <atom:updated>2014-05-16T16:32:14.457Z</atom:updated>
            <content:encoded><![CDATA[<h4>No coding required!</h4><p>If there is one business tool that each of us intuitively understand, it has to be scorecards. These simple tables have been a part and parcel of our lives right from school days to corporate performance reviews. The reason for their popularity and usage is ‘simplicity’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*Aq4w0Nhja1V_nOtW_yPQ7Q.png" /><figcaption>Card View</figcaption></figure><p>In this blog, we will see how to build and deploy performance scorecards that are both real-time and mobile ready in a matter of minutes using the Salesforce1 platform.</p><p><strong>Define your metrics</strong></p><p>The first step to building a scorecard is to identify the metrics you want to measure. Since we are building on the Analytics API, all we need to do is build out reports . In this example we will build out a scorecard for Accounts and for each acccount we want to measure — “Open Pipeline”, “Closed Pipeline” and “Number of cases”.</p><p>Note: Make sure all the reports are of summary or matrix format and grouped by the same type of value — like all are grouped by Account Name, Person name or State names etc.</p><p><strong>Install the app</strong></p><p>The entire app in this case is a single Visualforce page. Installation is just copying over the page fromGitHub:</p><p><a href="https://github.com/arun-sfdc/Analytics-API/blob/master/scorecard.page">https://github.com/arun-sfdc/Analytics-API/blob/master/scorecard.page</a></p><p>To surface it in Salesforce1 follow these steps</p><ol><li>Setup-&gt;Create-&gt;Tabs-&gt;VisualforceTab.</li><li>Setup-&gt;Mobile Admin-&gt;Navigation</li></ol><p><strong>Configure your reports</strong></p><p>The last step in the process is to define the metrics by specifying labels and report IDs. In the visualforce page look for the following lines and update it. By default, all the metrics in the report are imported except record count(unless it the only one).</p><pre>var HEADER = [‘Account’, ‘Open ‘, ‘Closed’, ‘Cases ‘]; </pre><pre>var REPORTS = [‘00Of0000000YMYV’, ‘00Of0000000YMYa’, ‘00Of0000000YMYf’];</pre><p>Now you’re all set to start tracking your business wherever you are and in real-time. Give it a try and let me know how it works out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e741043b5ee8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/mobile-scorecards-with-salesforce1-e741043b5ee8">Mobile Scorecards with Salesforce1</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publishing Salesforce Reports with  PDF templates]]></title>
            <link>https://medium.com/salesforce-analytics/publishing-salesforce-reports-with-pdf-templates-2b2517d74492?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/2b2517d74492</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Wed, 19 Mar 2014 06:26:25 GMT</pubDate>
            <atom:updated>2014-03-19T06:49:45.168Z</atom:updated>
            <content:encoded><![CDATA[<h4>In under 100 lines of code.</h4><p>When was the last time you wanted to export your Salesforce Report to PDF? Look no further; in this blog we will explore how you can use the new Analytics API in APEX with Visualforce templates to produce high-quality documents with customized layouts.</p><p><strong>Design the Template</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*YxbPGLBYSwKkinH1aGPHrw.png" /></figure><p>In the example above , the goal is to take a simple Accounts report that is in summary format and turn into a pixel-perfect custom document with company logo and custom title. Once the design is done, make sure all the assets are uploaded as “Static Resources”. Now go ahead and prototype the sample pdf page using Visualforce. Look at the example here: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/ReportPDF/reportPDF.page">https://github.com/arun-sfdc/Analytics-API/blob/master/ReportPDF/reportPDF.page</a></p><p>In addition to custom layout, we also include custom formatting, all opportunities over 100K are highlighted with a red background. This is something we need to implement using our model &amp; controller.</p><p><strong>Setup the backend and report</strong></p><p>Once the Visualforce page is setup, all you need is a simple controller that passes in some sample data. With this step complete, you should be able to produce a PDF that looks very much like your design. In this example here: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/ReportPDF/ReportPDFController.cls">https://github.com/arun-sfdc/Analytics-API/blob/master/ReportPDF/ReportPDFController.cls</a> , we have two controller methods — one to generate the table headers and the other to generate the data. The end result will be set of pages — one page for each account. Each of these pages will include a table containing the Key Metrics or KPIs on each of the open opportunities for that account.</p><p><strong>Hook-up the Analytics API</strong></p><p>The last step is to plug-in the Analytics API so you are feeding actual data into your backend. Here in this example we have 3 APEX class — the first two form the standard Visitor pattern and third class is the controller that generates the content. The main reason for using the Visitor pattern is to build different templating examples while reusing most of the report parsing code.</p><p>Go ahead, give it a spin and let me know how it goes!</p><p>Code on GitHub: <a href="https://github.com/arun-sfdc/Analytics-API/tree/master/ReportPDF">https://github.com/arun-sfdc/Analytics-API/tree/master/ReportPDF</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b2517d74492" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/publishing-salesforce-reports-with-pdf-templates-2b2517d74492">Publishing Salesforce Reports with  PDF templates</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Live Dashboards  using Analytics API — Summer’14]]></title>
            <link>https://medium.com/salesforce-analytics/live-dashboards-using-analytics-api-summer14-ab786197a2e3?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab786197a2e3</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Tue, 04 Feb 2014 17:24:11 GMT</pubDate>
            <atom:updated>2014-05-23T06:40:27.908Z</atom:updated>
            <content:encoded><![CDATA[<h4>In 50 lines of code!</h4><p>One of the easiest ways to empower your Sales team is to put a live dashboard on HDTVs. Not only does everybody on the team know where they stand but can also see how they’re doing relative to their peers. This kind of a live dashboard is valuable in non-sales environments like Call Centers or Performance monitoring groups.</p><p><strong>“Dashboards in the Analytics API”</strong></p><p>In Spring’14, Salesforce is adding Dashboards to the Analytics API. Similar to Reports, Dashboard will be available in the Analytics REST API under the URL end-point: /services/data/v30.0/analytics/dashboards/. The API supports the 3 key operations — fetch, refresh and poll.</p><p><strong>Setup your Salesforce Dashboard</strong></p><p>Let’s start with a your Salesforce dashboard, the one below has five key-metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*tq_h51soKK56r99dvzlQYw.png" /></figure><p><strong>Define your 4-column DashboardUI</strong></p><p>D3 is one my favourite charting solutions. So in this example we will define a custom UI that has a 4 columns of D3 charts. Since this is a completely custom UI that I get to define, I am no longer limited to the standard Salesforce 3 column Dashboard UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLA0F_vx3xx6qTr4XfdjRA.png" /></figure><p><strong>Turn it ON!</strong></p><p>The next step after defining your layout, is to plug-in the data from the API into D3 charts. This is a very simple and straight forward process, look at the example here: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/ngSfdcChart.js">https://github.com/arun-sfdc/Analytics-API/blob/master/ngSfdcChart.js</a></p><p>The final step is to make your Dashboard “LIVE”. In order to achieve this, all you need to do is to turn on auto-refresh. In this example, we set the dashboard to auto-refresh every 6 minutes using standard Javascript methods.</p><p>Complete self-contained example: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/customDashboard.page">https://github.com/arun-sfdc/Analytics-API/blob/master/customDashboard.page</a></p><p>There you have it, Live Salesforce Dashboards with completely custom UI in under 50 lines of code!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab786197a2e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/live-dashboards-using-analytics-api-summer14-ab786197a2e3">Live Dashboards  using Analytics API — Summer’14</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Empower your sales team with Historical Data!]]></title>
            <link>https://medium.com/salesforce-analytics/empower-your-sales-team-with-historical-data-e6102729d64c?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/e6102729d64c</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Mon, 27 Jan 2014 07:46:43 GMT</pubDate>
            <atom:updated>2014-01-27T08:24:51.100Z</atom:updated>
            <content:encoded><![CDATA[<h4>Get access to historical data right where you need it.</h4><p>With the Spring’14 release the Salesforce Analytics API allows users to dynamically choose date and get historical data. To understand how we can take advantage of this enhancement, lets take a look at the following screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*q_LDJBaXDbKus7Ry-qz59w.png" /><figcaption>Dynamically choose dates to compare historical and current data.</figcaption></figure><p><strong>Problem</strong></p><p>The sales manager monitoring the Acme account wants to looks at the open pipeline and compare it to what it was at the beginning of the week or even beginning of the month. Achieving this in any traditional business system would require access to the data-warehousing system — a time-consuming and expensive process and most business users would complain that IT isn’t helping them here. You don’t want to be the slow technology team that blocks business! With a simple custom app built on the Analytics API, you could be the super-hero who empowers the Sales team!</p><p><strong>Technology</strong></p><p>In Winter’14, Salesforce launched the Historical Reporting feature that provides easy real-time access to current and historical data within reports (More info: <a href="http://docs.releasenotes.salesforce.com/en-us/winter14/release-notes/rn_186_analytics_trending.htm">http://docs.releasenotes.salesforce.com/en-us/winter14/release-notes/rn_186_analytics_trending.htm</a>). Starting Spring’14, these reports are not only available in the Analytics API but they can be dynamically configured to change the snapshot dates.</p><p><strong>Solution</strong></p><p>Combining the power of Visualforce, D3 Charts and Analytics API we can easily spin up a solution that empowers your Sales team with historical data. By embedding it on the account page with a dynamic jQuery data selector we can take a it a notch further. Now the sales team has the analytics they need in seconds and its right in context too!</p><p>Source Code: <a href="https://github.com/arun-sfdc/Historical-Trending-Analytics-API">https://github.com/arun-sfdc/Historical-Trending-Analytics-API</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6102729d64c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/empower-your-sales-team-with-historical-data-e6102729d64c">Empower your sales team with Historical Data!</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Salesforce Reports with D3 Charts]]></title>
            <link>https://medium.com/salesforce-analytics/visualizing-salesforce-reports-with-d3-charts-c87517ab52b1?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/c87517ab52b1</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Mon, 28 Oct 2013 04:28:56 GMT</pubDate>
            <atom:updated>2013-10-15T05:08:13.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/595/0*z-17Ucs0QFXvO48B.png" /><figcaption>Source: http://nvd3.org/</figcaption></figure><h4>Less than 30 lines of code!</h4><p>SourceCode: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/d3ReportChart.page">https://github.com/arun-sfdc/Analytics-API/blob/master/d3ReportChart.page</a></p><p>The <a href="http://www.salesforce.com/us/developer/docs/api_analytics/salesforce_analytics_rest_api.pdf">Analytics API</a> really opens up what we can do with Salesforce Reports. <a href="http://d3js.org/">D3.js</a> is one of the most powerful and important charting engines and in this blog post we will explore how to integrate it with report data.</p><h4>Step1: Execute the Report</h4><p>Thanks to the Summer’13 Force.com enhancement that allows use to access REST APIs directly from Visualforce, we can run a report and get the dataset in less than 10 lines of code.</p><blockquote>$.ajax(‘/services/data/v29.0/analytics/reports/{!$CurrentPage.parameters.reportId}’,{ beforeSend: function(xhr) { xhr.setRequestHeader(‘Authorization’, ‘Bearer {!$Api.Session_ID}’); },success: function(response) { console.log(response); } });</blockquote><h4>Step2: Setup a Sample Chart</h4><p>Starting with a sample chart makes it easier to understand the data format. Instead of using <a href="http://d3js.org/">D3.js</a> directly, we will be using the derivate <a href="http://nvd3.org/">NVD3</a> which is easier to configure and has a simpler data format. The following sample is from <a href="http://stackoverflow.com/a/13541771">StackExchange</a>.</p><blockquote>var chart = nv.models.multiBarChart(); d3.select(&#39;#chart&#39;).datum([ { key: &quot;S1&quot;, values:[ { x : &quot;A&quot;, y : 40 },{ x : &quot;B&quot;, y : 30 },{ x : 5, y : 20 } ] }, { key: &quot;S2&quot;, values:[ { x : &quot;A&quot;, y : 60 },{ x : &quot;B&quot;, y : 50 },{ x : 5, y : 70 } ] } ]).transition().duration(500).call(chart);</blockquote><h4>Step3: Wiring it together</h4><p>The final step is to map the report results from the API into the chart data format. The salesforce <strong>“Matrix” </strong>report format is best suited to be mapped into a multi-bar chart. Its evident from the mapping code that the Analytics API data format has been designed to be easily pluggable into chart engines.</p><blockquote>var chartData = []; $.each(response.groupingsDown.groupings, function(di, de) { var values = []; chartData.push({&quot;key&quot;:de.label, &quot;values&quot;: values}); $.each(response.groupingsAcross.groupings, function(ai, ae) { values.push({&quot;x&quot;: ae.label, &quot;y&quot;: response.factMap[de.key+&quot;!&quot;+ae.key].aggregates[0].value}); }); });</blockquote><p>The complete self-contained source code for the VisualForce page is available here on <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/d3ReportChart.page">GitHub</a>.</p><p>SourceCode: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/d3ReportChart.page">https://github.com/arun-sfdc/Analytics-API/blob/master/d3ReportChart.page</a></p><p>There you have it, Salesforce reports as D3 charts !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c87517ab52b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/visualizing-salesforce-reports-with-d3-charts-c87517ab52b1">Visualizing Salesforce Reports with D3 Charts</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Salesforce Data with Google GeoMaps]]></title>
            <link>https://medium.com/salesforce-analytics/visualizing-salesforce-data-with-google-geomaps-13c4a1198953?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/13c4a1198953</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Mon, 28 Oct 2013 04:28:45 GMT</pubDate>
            <atom:updated>2013-10-20T19:39:17.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/561/0*IWtjKV1rYyKKHDDV.png" /></figure><h4>Less than 30 lines of code!</h4><p>Source Code: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/googleMapReportChart">https://github.com/arun-sfdc/Analytics-API/blob/master/googleMapReportChart</a></p><p>What better way to look at your geographic data than using Maps? In this post we will see how easy it is to integrate data from Salesforce reports with Google GeoMaps. This is the second post in the Analytics API series. (<a href="https://medium.com/p/c87517ab52b1">Previous post on Salesforce + D3 charts</a>).</p><h4>Step1: Setup the Source Report</h4><p>With the emergence of the Analytics API we can use user-defined reports as data sources for our applications. In this post, we will use a simple summary report as our data source. This report shows the number of “Open Cases” by source Country.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/0*4yOwQuylVdMiC7db.png" /><figcaption>Sample Summary Report Open Cases by Country</figcaption></figure><h4>Step2: Transform Report Result to Google DataTable</h4><p>Almost all the Google Visualizations use a standard data format called the data table. Now we will transform the results from the Analytics API into that format.</p><blockquote>var chartPoints = []; $.each(reportResult.groupingsDown.groupings, function (index, value) { chartPoints.push([value.label, reportResult.factMap[value.key + “!T”].aggregates[0].value]); }); var options = {}; var labels = [ [‘Country’, ‘Metric’] ]; var myData = google.visualization.arrayToDataTable(labels.concat(chartPoints));</blockquote><h4>Step3: Visualize!</h4><p>The last step of course, is to initialize a google map with the newly created data table.</p><blockquote>var chart = new google.visualization.GeoMap(document.getElementById(‘chart’));<br>chart.draw(myData, options);</blockquote><p>There you have it, Google GeoMaps on Salesforce Data in under 30 lines of code. The entire component is available for download as a self-contained Visualforce Page on Github (<a href="https://github.com/arun-sfdc/Analytics-API/blob/master/googleMapReportChart">https://github.com/arun-sfdc/Analytics-API/blob/master/googleMapReportChart</a>).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13c4a1198953" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/visualizing-salesforce-data-with-google-geomaps-13c4a1198953">Visualizing Salesforce Data with Google GeoMaps</a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Actionable Analytics using Chatter  ]]></title>
            <link>https://medium.com/salesforce-analytics/actionable-analytics-using-chatter-744dbcd267ef?source=rss----dd19862cc160---4</link>
            <guid isPermaLink="false">https://medium.com/p/744dbcd267ef</guid>
            <dc:creator><![CDATA[Arun V]]></dc:creator>
            <pubDate>Mon, 28 Oct 2013 04:28:34 GMT</pubDate>
            <atom:updated>2013-10-28T04:22:01.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*Zv8s_wm8Q5KdUv5kr4uCCQ.png" /></figure><h4>Less than 30 lines of code!</h4><p>Most often users have to open the report in one tab, Chatter in another and then go through the manual process of navigating to their Chatter page to post the message. With the advent of the Analytics API, we can easily build a simple solution to solve this use-case and that too in under 30 lines of code.</p><h4>Step1: Let’s start with the Source Report</h4><p>For this example, we will use the report that gives us the names of case owners and the number of open cases. We will use this report as a source and make chatter posts to the respective case owners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*J6LZZIIIbDbBJFFBio6WaQ.png" /></figure><h4>Step2: Running a report using APEX</h4><p>In order to make a HTTP callout to the Analytics API REST endpoint we should open the access to the remote site. You can do it under the “Remote Site” section in Setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*GiRMzNpWAQOZE5eK1_HFbA.png" /></figure><p>Once the callout access can be enabled, the actual code to run a report from APEX is just 5 lines.</p><blockquote>// Run Report using Analytics API<br>HttpRequest req = new HttpRequest();<br>req.setEndpoint(‘<a href="https://cs12.salesforce.com/services/data/v29.0/analytics/reports/00OV0000000OTyR%27">https://cs12.salesforce.com/services/data/v29.0/analytics/reports/00OV0000000OTyR</a>’);<br>req.setHeader(‘Authorization’, ‘Bearer ‘+ UserInfo.getSessionId());<br>req.setMethod(‘GET’);<br>Http http = new Http();<br>HTTPResponse res = http.send(req);</blockquote><h4>Step3: Get the list of case owners</h4><p>The Analytics API uses JSON for both request and response. In order to make it easy to interact with JSON response we will be using this simple wrapper object — JSObject — <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/JSObject.apex">https://github.com/arun-sfdc/Analytics-API/blob/master/JSObject.apex</a></p><blockquote>JSObject reportResult = JSObject.wrap(JSON.deserializeUntyped(res.getBody()));</blockquote><blockquote>reportResult.getAsObject(‘groupingsDown’).getAsList(‘groupings’)</blockquote><h4>Step4: Make a Chatter post of every user</h4><p>Once we have the report results in APEX, the process of getting the list of case owners and the number of open cases is fairly straight-forward. Also, since Chatter is natively available in APEX, the actual integration code is less than 10 lines.</p><blockquote>// Make a feed post for each user in the report<br>List&lt;FeedItem&gt; posts = new List&lt;FeedItem&gt;();<br>for(JSObject user: reportResult.getAsObject(‘groupingsDown’).getAsList(‘groupings’)) {</blockquote><blockquote>String factMapKey = user.get(‘key’)+’!T’; // Refer to “Decode the FactMap” JSObject factMapEntry = reportResult.getAsObject(‘factMap’).getAsObject(factMapKey);</blockquote><blockquote>String numCases = (String) factMapEntry.getAsList(‘aggregates’).get(0).get(‘label’); // Construct the Feed object</blockquote><blockquote>FeedItem post = new FeedItem(); post.parentId = (Id)user.get(‘value’); post.body = ‘Alert!! You have ‘+ numCases + ‘ open cases.’; posts.add(post);<br>}<br>insert posts;</blockquote><p>If you would like to download the complete source code, please follow these GitHub links:</p><p>ReportToChatter.apex: <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/reportToChatter.apex">https://github.com/arun-sfdc/Analytics-API/blob/master/reportToChatter.apex</a></p><p>JSObject — <a href="https://github.com/arun-sfdc/Analytics-API/blob/master/JSObject.apex">https://github.com/arun-sfdc/Analytics-API/blob/master/JSObject.apex</a></p><h4>Previous Blog Posts:</h4><p>D3: <a href="https://medium.com/p/c87517ab52b1">https://medium.com/p/c87517ab52b1</a></p><p>Google Maps: <a href="https://medium.com/p/13c4a1198953">https://medium.com/p/13c4a1198953</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=744dbcd267ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-analytics/actionable-analytics-using-chatter-744dbcd267ef">Actionable Analytics using Chatter  </a> was originally published in <a href="https://medium.com/salesforce-analytics">Salesforce Analytics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>