Display timestamp on your Anaplan dashboard

Hannah
edited September 17 in Blog

Author: Hannah Shan is a Certified Master Anaplanner and Senior Consultant at Lionpoint Group.

I've come across discussions about whether there's a way to display the action timestamp on the UX for the end user — and there have been some great suggestions to bring in the date by leveraging CloudWorks. But what if the end user wants to see a more accurate time? In this blog, I present a workaround to show a “timestamp” on the dashboard (I'm using quotation marks because this method only provides a very rough estimate of the last run time of your processes). However, this method is quick and easy to set up, using the power of AWS and CloudWorks without diving into complex coding. It only requires a basic understanding of AWS’s S3 and Lambda functions and can be set up in about 20 minutes. Here I’ll show the step-by-step guide using AWS — the same concept should be applied using Azure Blob as well.

Step-by-step instructions

Step 1: Create a module in Anaplan

First, add a module to your Anaplan model to hold the imported current time. Format the line item “Time” as text to make it easily to show on a dashboard. This module will serve as the place to hold for the most up-to-date timestamps, ensuring that every time the Cloudworkd integration runs, the latest run time is recorded and displayed.

Step 2: Store csv in an S3 bucket and create a import action to bring the time from csv to Anaplan

Next, create a csv file and upload to an AWS S3 bucket to hold your timestamp. This file will be the source of truth for the last run time. Create the import action to map the csv to your module:

Step 3: Connect CloudWorks with S3 bucket

Add a CloudWorks connection to your csv file in the S3 bucket. Schedule the action to run at your desired frequency. For example, you can set the import action to run every hour from 8:00 a.m. to 8:00 p.m. on workdays. This setup will enable CloudWorks to pull the latest timestamp from the S3 bucket and update your Anaplan module accordingly.

Step 4: Use Lambda function to update the csv file in S3 bucket

We’ll use an AWS Lambda function to update our CSV file in the S3 bucket every time the import action is run:

  1. Create a Lambda function:
    Set up a new Lambda function with the basic configuration and choose Python as the runtime.
  2. Code the function:
    Remove the default code and replace it with the attached sample script. (See the bottom of this post for that file.) Ensure you update the bucket_name and file_key with your S3 bucket details. This code will update cell A2 in the csv file with the current time whenever it runs. You can adjust the time zone by modifying the offset hours in the script (row 19). This allows you to adjust to different time zones as needed.
  3. Test the function:
    Select the blue "Test" button to ensure the script is working. The output should show “csv updated successfully!” Check the csv file in your S3 bucket to confirm that the timestamp has been updated. Testing your Lambda function is import to ensure that it correctly updates the timestamp before automate the process.

Step 5: Schedule the Lambda function with CloudWatch

To keep your csv file up-to-date, we need to schedule the Lambda function to run at the same frequency as your CloudWorks action. Here’s how:

  1. Open CloudWatch console:
    Navigate to the rules section.
  2. Create a new rule:
    1. Choose “Recurring schedule” and specify the schedule using a rate or cron expression. For example, a cron expression 0 * * * * will run the function at the start of every hour.
    2. Select your Lambda function from the list of target types. You can skip other input configuration.
    3. Provide a name and description for your rule, then select “create”. This rule will automate the running of your Lambda function, which will update the csv file in S3 bucket.

Bringing it all together

Now that we have a module in our Anaplan model that refreshes time every hour, the final step is to display this on your dashboard when an action or process is run. Create an action in Anaplan to import the text of updated time to a placeholder which will be published on dashboard and add this action to your process. Every time an end user runs the process, the dashboard will show the most recent timestamp. This ensures that users always see the latest process run time with an error between 0 to 59 minutes.

Enhancing accuracy and functionality

While this workaround provides a rough estimate of the last run time, for more precise results, consider using an API connection. This method, however, is easy to set up and maintain. Plus, it can run on AWS's free tier (for now).

The potential doesn’t stop there. With CloudWorks and AWS Lambda, you can automate even more tasks. For example, you could use lambda functions to fetch real-time FX rates or SOFR rates and refresh your Anaplan modules daily: you can automate updates for any data that can be fetched through an API and stored in a csv file in your S3 bucket.

By following these steps, you’ll have a dynamic Anaplan dashboard that keeps your users informed with the latest process run times and more. The combination of AWS Lambda, CloudWatch, and CloudWorks offers a powerful, scalable, and cost-effective solution to enhance your Anaplan workflows. Happy automating!

Questions? Leave a comment!