+ Start a Discussion
Dhivya kolanchiappaDhivya kolanchiappa 

Current Weather report

hi,
 can anyone help me to find a way to get current weather report for account records???? 
CheyneCheyne
You can use the WUnderground weather API: http://www.wunderground.com/weather/api/d/docs?d=resources/code-samples&MR=1 (http://www.wunderground.com/weather/api/d/docs?d=resources/code-samples&MR=1" target="_blank) to create a Visualforce page, using the standard account controller, and add the page to the Account page layout. Here's some basic code, modified from the WUnderground documentation:

<apex:page standardController="Account">
  <h3>Current Weather</h3>
  <div id="current-weather"></div>
 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
  <script>
    jQuery(document).ready(function($) {
      $.ajax({
      url : "https://api.wunderground.com/api/<YOUR_API_KEY_GOES_HERE>/geolookup/conditions/q/{!Account.BillingState}/{!Account.BillingCity}.json",
      dataType : "jsonp",
      success : function(parsed_json) {
        var location = parsed_json['location']['city'];
        var temp_f = parsed_json['current_observation']['temp_f'];
        $("#current-weather").text("Current temperature in " + location + " is " + temp_f);
      }
    });
  });
  </script>
</apex:page>
nik2 bug2nik2 bug2
nik2 bug2nik2 bug2
nik2 bug2nik2 bug2
nik bugnik bug
test1234
Ajit Kumar 118Ajit Kumar 118
Hi, Dhivya!

If you want to have a weather report of Account Records, I would suggest you a wonderful Application named as 'Smart Multi Weather Information', which you can install from AppExchange that would get you the weather forecasts of not only Account records, but also of Leads, Contacts and Contracts. You can go through the link below to install it: 

https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000DXzYeEAL

For a better understanding, you can also check our user guide manual https://webkul.com/blog/salesforce-smart-multi-weather-information/

This application displays a complete Weather Forecast of above mentioned objects in detail.

Feel free to contact us anytime if you have any issue related to configuration of this Application.

Support: https://support@webkul.com

Ajit Kumar
Salesforce Consultant
Webkul Software Private Ltd.
Ajit Kumar 118Ajit Kumar 118
The above Application can do the trick for you, you don't need to worry about writing long codes for getting the Weather Forecast. Install it once and trust me you won't be disappointed.