Prerequisites:

-This article is designed for those more advanced with Anaplan Connect

-Utilizing CA Certificates is best practice for Anaplan Data Integrations. The Master Script is best leveraged with CA Certificate authentication in the individual scripts for security purposes. If you would like to learn more about CA Certificates, click on the guide below which I co-authored. Note: Basic Authentication used for demo purposes.

Interactive CA Certificate Guide

Imagine this scenario: You have an Anaplan Connect environment setup to run your daily processes. There are dozens of scripts in your folder that you need to schedule for the same recurring cadence. What do you do?

Solution: Create a Master Script! The Master Script method allows you to bundle your scripts together and schedule them all at once. For Anaplan Connect administrators, this saves time upfront when scheduling your scripts and reduces the maintenance effort.

Here's how: Creating a Master Script is an easy process! This will require some attention to detail.

  1. In your Anaplan Connect folder, create your individual scripts (these are your scripts that execute actions, imports, processes etc.)
  2. Ensure all of your individual scripts are saved with no spaces in the filename
  3. Create your Master Script. "Call" is an operator which triggers each individual script to run. Note: It is best practice to name your batch files with no spaces as spaces can sometimes introduce errors when executing Anaplan Connect (see example Master Script below)

----------------------

MasterScript Example:

Call Example1
Call Example2
Call Example3
Call Example4
Call Example5

----------------------

Your folder should look something like this:

No alt text provided for this image

4. Ensure your individual scripts do not contain the "pause" command at the end of the script. The "pause" command triggers a break and requires a manual trigger/input to move onto the next command.

For the purposes of the Master Script, we will not use the "pause" command in the individual scripts. You may choose to keep the "pause" command in the final individual script being run, to be able to review the command log at the end of the execution. In my example, I have kept the "pause" command at the end of Example5 as that is the last script in my MasterScript.

Notice the differences below between Example1-Example4 vs. Example5 with regards to the "pause" command. Also notice how both scripts maintain a consistent template and structure, this is also another best practice which should be leveraged with all scripts. More on this to come in a future article.

----------------------

Example1-Example4 Scripts

set AnaplanUser= your@emailaddress.com:yourAnaplanpassword

set WorkspaceId="YourWorkspaceID"

set ModelId="YourModelID"

set ServiceUrl="https://api.anaplan.com"

set AuthUrl="https://auth.anaplan.com"

set ProcessName="Your Process"

set Chunksize=1

set Operation= -debug -service %ServiceUrl% -auth %AuthUrl% -process %ProcessName% -execute

set Credentials= -User %AnaplanUser%

rem *** End of settings - Do not edit below this line ***

setlocal enableextensions enabledelayedexpansion || exit /b 1

cd %~dp0        

set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%

@echo %Command%

cmd /c %Command%

----------------------

You can see that Example1-Example4 scripts do not have the "pause" command. Whereas Example5 does.

----------------------

Example5 Script:  

set AnaplanUser= your@emailaddress.com:yourAnaplanpassword

set WorkspaceId="YourWorkspaceID"

set ModelId="YourModelID"

set ServiceUrl="https://api.anaplan.com"

set AuthUrl="https://auth.anaplan.com"

set ProcessName="Your Process"

set Chunksize=1

set Operation= -debug -service %ServiceUrl% -auth %AuthUrl% -process %ProcessName% -execute

set Credentials= -User %AnaplanUser%

rem *** End of settings - Do not edit below this line ***

setlocal enableextensions enabledelayedexpansion || exit /b 1

cd %~dp0        

set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%

@echo %Command%

cmd /c %Command%

pause

----------------------

A word of caution: notice that the Anaplan Connect script contains a section which says, "do not edit below this line". If you are not confident or comfortable in creating scripts, you should truly not edit below the line.

This article is designed for those more advanced in Anaplan Connect. Anaplan does not Support any custom Anaplan Connect scripting, in which changes are made below the line in individual scripts, or to the Client.bat file. If you are not advanced or proficient with Anaplan Connect, it is reccommended you follow the examples provided in the examples folder as part of your Anaplan Connect download for individual scripts.

Your end result should look something like this (sanitized console output):

No alt text provided for this image

Use Cases:

-Any new Anaplan Connect environment that will contain multiple scheduled individual scripts

-Any existing Anaplan Connect environment running multiple scheduled individual scripts, that could be grouped together

Things to Consider:

-Sometimes, there are benefits to not running every script at the same time, whether it be order of operations, data availability, or data flow

-However, there are times when maintaining hundreds of Anaplan Connect scripts individually can become burdensome

-It is best practice to schedule your scripts to run during off-peak hours when most users are offline, typically scripts should be scheduled overnight. This will help you avoid performance issues during the day when most users are online and enable an effective and efficient Anaplan Connect execution

-Each Anaplan Connect implementation is different. Evaluate your needs to see if you are able to administer your Anaplan Connect environment with a MasterScript or multiple MasterScripts