Create a weather feed using Nintex Workflow

In this post I will be running through the process of creating a customisable weather feed using Nintex Workflow and the Content Query Web Part (CQWP). I’ve seen quite a few weather web parts out there but for the most part I have found them to look quite dated. Nintex Workflow introduces a Live Catalog of actions that can be installed and provide the ability to interact with various services on the web. One of these actions provides the ability to retrieve data from the Weather Underground. In this example we will populate a SharePoint list with the data retrieved from this service and then use this to drive an attractive weather feed.

The final result will look something like the screenshot below, since we are styling this with XSLT it offers us an additional level of flexibility by being able to customise it to our liking.

Current Weather


Create the list

Create a custom list with the following columns, this can be called anything you like, I imaginatively called mine ‘Weather’.

Column Name Type Required
City Single line of text Yes
Country Single line of text Yes
Unit Choice:
Temperature Single line of text No
Forecast Single line of text No
Last Updated Date and Time No

Populate the list with one or more entries, include the city, country and the unit that you would like the temperature to be returned in (Celsius or Fahrenheit).

Weather Entries

Create the workflow

We will create a site workflow that reads in the city names from the Weather list and then fetches the associated weather observation data and then writes this information back.

  1. Start creating a site workflow by clicking the settings cog and select Nintex Workflow 2013 > Create Site Workflow.
  2. Create the following variables, these variables will be used throughout the workflow.
    Variable Name Type
    Temp Number
    Forecast Multiple Lines of Text
    Last Updated Multiple Lines of Text
    Unit Single Line of Text
    Cities Collection
    City List Item Single Line of Text
    City Name Single Line of Text
    Country Single Line of Text
  3. Drag the Query list action on to the workflow designer and configure it as follows.

  4. Next we will use a For Each loop and configure it with the following settings.

  5. Add a Query List action within the For Each loop and configure it with the following settings.

  6. Now that we have gathered the city details we can query the Weather Underground service. If you haven’t added this action to your environment it will be necessary to open the Nintex Live Catalog and add the action. The availability of this feature is dependent on whether it has been allowed/enabled in your environment. If all is good, you should see a ribbon icon for the Nintex Live Catalog while in the Workflow Designer.
  7. Click the Catalog icon and do a search for ‘Weather’, the following action will appear. Click the Add button, once complete it will show as Added.
    Weather Underground Action
  8. Close the Catalog window and add the Wunderground Weather action to your workflow. This will sit inside our For Each loop and will occur after querying for the City details. Open the action and configure it with the following details.
  9. The last step in the workflow is to update the list item with the current observation data. Drag an Update Item action into your workflow, still within the For Each Loop and configure it with the following settings.Update Item Action Settings

Use the Content Query Web Part to display the results on a page

I’ve created the following basic XSL template, the cool thing about this is that you have full control to easily modify the way the weather appears on your page. This provides you with a heap of control, much more than you would otherwise have if you used a third party web part.

The Content Query Web Part by default uses styles that reside in the Style Library of your site collection. The template below will be added to the ItemStyle.xsl.

Add the following CSS to the page that you will be displaying the weather on, this can be done in a number of ways e.g. adding a custom stylesheet to your masterpage or adding the CSS directly on the page.

Once you have done this your weather feed is complete. The site workflow can be easily scheduled ensuring the data presented is current and up to date.

Leave a Reply

Next ArticleNintex Workflow: Checking if a user is a member of a SharePoint group