Easily Get Current Date Using CloudWorks

Almost any model builder has had to come up with a solution to get the current date in Anaplan. We used to build integrations and use API for that. @JaredDolich posted a great article about using python for getting today's date.

But this approach has some cons:

  • You must learn to code or involve someone who can do it. Both options are time-consuming and sometimes require an extra budget.
  • Because we rely on an external system, it brings extra chances of failure (both Anaplan outages and server outages will cause a failure).
  • You'll likely require someone to support it once it's running.

But now this can be done by any model builder, without external systems and coding. It will take only 30-60 minutes of your time and no coding to set it up—with CloudWorks. 

How To Do It

The idea is to use CloudWorks to run a process that adds up +1 day to line item with date, but we'll also see how it can be made more reliable. This method will save us from Anaplan maintenance or downtime. If they take place at the scheduled time, we'll be protected.

STEP 1: 

Create a module with a dummy item (dummy item will help to set up import action). The screenshot below shows a blueprint of the module.

Hayk_0-1629440853340.png

Hayk_1-1629442437744.png

MAIN date - current date, the value is imported from MAIN date + 1 on a scheduled basis via CloudWorks.

MAIN date + 1 - formula adds +1 day to MAIN date line item. It also checks if the last run of MAIN process has failed. If so, it adds up +2 days to MAIN date, so we get back to the correct date.

MAIN last run failed? - checking if the last scheduled run of MAIN process has failed. If BACKUP date is greater than MAIN date, we understand that MAIN run has failed (because we schedule MAIN process to run first, before BACKUP).

BACKUP date - same as main, but works as a backup and is imported from BACKUP date + 1

BACKUP date + 1 - formula adds +1 day to BACKUP date line item. It also checks if last run of BACKUP process failed. If so, it adds up +2 days to BACKUP date to correct itself.

BACKUP last run failed? - checking if the last scheduled run of BACKUP process has failed. We do it by comparing the difference between backup and main dates. It shouldn't be more than 1 day. If so, it means the last run of the backup process has failed.

Current date final - takes maximum between MAIN and BACKUP dates, so if one of them has failed, current date final will be correct.

STEP 2: 

Set up two views where only MAIN date + 1 and BACKUP date + 1 line items are visible. Use these views to set up import of date from MAIN date + 1 into MAIN date and BACKUP date + 1 into BACKUP date respectively. Both imports then should be included in separate processes, so we can schedule them with CloudWorks.

Hayk_0-1629443522848.png

Hayk_0-1629443918158.png

STEP 3:

Schedule main and backup CloudWorks processes. I scheduled main for 00:30 AM and backup for 6:00 AM local time (Anaplan maintenance usually takes four hours). You can learn how to set up CloudWorks integration here.

Hayk_0-1629445721077.png

STEP 4:

You'll need to manually input the correct MAIN date and BACKUP date for the first time. Going forward the process takes care of it.

That's it! You now have a current date in a model, which is protected from outages and maintenances.

The content in this article has not been evaluated for all Anaplan implementations and may not be recommended for your specific situation.
Please consult your internal administrators prior to applying any of the ideas or steps in this article.
Comments

Cleverly! Thanks for the advice, we will use 🙂

We will use too 😎 !! Thanks for the tip

Awesome article @Hayk - clearly one of the most critical imports needed for a fully automated anaplan data integration initiative. Hopefully we'll get the TODAY() function eventually. 

wow!!! Neat and Clever. Awesome @Hayk . And I agree with @JaredDolich to have TODAY() function in Anaplan lists of functions.

 

BEAUTIFUL! 🚀

Clever! especially the backup date part  Thanks for sharing 

Version history
Last update:
3 weeks ago
Updated by:
About the Author
Contributors
Labels (2)