Automating Methods Using the Aras Scheduler Service

Do you need to run a method at a specific time? How about a database intensive task you want to run after hours? Or a notification service? With the subscriber feature Aras Scheduling Service, you can do all of those things. It's as simple as installing the service (included in your CD Image), setting up a config file, and selecting the methods you wish to run.

What is the Scheduling Service?

The Aras Scheduling Service is a Windows Service that runs in the background of your computer. It can automatically run Innovator Methods on a set schedule, which you set up using the attached config file via XML. The service is extremely flexible and can even run methods on multiple servers from a single instance. The Windows Event Viewer is where you can find logging, status, and error messages for the service once you get it running.

Installing the Service

The service can be installed from your Innovator CD image in the Scheduler folder using the below instructions:

Files to Select

  1. Copy the files listed below (or see the above image) into a separate folder on your hard drive (Ex: C:\Aras_Scheduler) to access them outside of the CD image.
    1. InnovatorService.exe
    2. InstallService BAT
    3. rserv BAT
    4. InnovatorServiceConfig.xml
  2. Update the config file to match your Innovator instance. If you have multiple servers, set up each you wish to access using a separate <innovator> tag. (See the next section for further details on how to set up the file.)
    1. Unless you have an existing method you wish to test, it is suggested you leave the test method included in the file in place until you complete setup. It will give you a point of reference to trace any issues.
  3. Run the file InstallService.bat using a command window opened with administrator privileges (R-click on cmd.exe, Run as Administrator...). You will need to change the operating directory to where the file is stored using a cd command. (Ex. cd C:\Aras_Scheduler) 
    1. You will be prompted for a user name and password. This is the user that will need to have clearance to run Windows Services. Use a full domain user name (domain_name\user_name).
    2. If the installation fails, the user name and password might be incorrect or do not have the right privileges to run the program. Check your credentials or contact your system administrator.
  4. When the installation runs successfully, you can access the Services Management Console (Search for Services in the Start menu) to make sure the service named “Innovator Service” has been added to system.
    1. You can then configure when to start the service, set to Automatic, etc. You can also edit the user name and password that will execute this service or use the Local System Account.

Configuring the Service

To configure your scheduling service just the way you want it, you will need to edit the InnovatorServiceConfig.xml file. Below is a list of the available settings while an outline of the file is in the gist above.

Tag Purpose Notes
<innovator> Defines an Innovator Server instance There can be multiple instances available to a single service instance
<server> The URL of your innovator server Ex: http://localhost/myserver
<database> The database your server uses Ex: InnovatorSolutions
<username> The username allowed to run the methods Ex: admin
<password> Password for associated user Ex: innovator
<method> a method to run according to the below schedule Ex: My Method

The months (1-12) where a method should run, comma delimited list.

Note: for all the date values (months, days, hours, minutes) a * can be used as a wildcard to indicate that level should be ignored.

Eg. 3,6,9,12 with a <days>last</days> would run at the end of the standard quarter.
<days> The days of the week a method should run (0-6, Sunday-Saturday), comma delimited list. Special value: "last" for the last day of the current month
<hours> Hours of the day a method should run (0-23), comma delimited list Eg. Hour 0, minute 02 would be an example for a midnight batch run to update from a federated source
<minutes> Minutes of the hour a method should run (0-59), comma delimited list. Special value: "once", will be run once within the hour, but exactly when is not important Eg. 0,15,30,45 would fire every quarter hour

Sets level of detail for event logging:

  • 0 = Service startup announcement and error messages from Innovator only
  • 1 = Announces the start of every Method run
  • 2 = Detailed reporting of every run cycle.
<intervalMinutes> Indicates how often, in minutes, the Windows Scheduler should test the timing logic (1-60)

Note: For more information, please see Scheduler file in the documentation folder in your CD image folder. Information about event logging and the Windows Event Monitor can be found here as well.

Example: Email Notification

In this example, we are sending out an email for incomplete work at midnight every night. This could easily be changed to a more database intensive task that you do not want to run during normal operational hours.

Scheduler Code

To explain the above: the method listed is executed at midnight plus 2 minutes to account for any timing errors. The Service Interval check is set for 1 minute to ensure the method will run on time, and detailed reporting (service level 2) is set in case anything goes wrong. [Midnight runs are typically used for important server or database heavy events that would bog down service during normal business hours. And if anything goes wrong, someone will need to be notified.]

Email Send Method Code

The Method uses an existing method of the Email Item class to send an email message to a user (in this case, it’s the admin). It takes an existing email Item in Innovator (which already contains a Subject, Sender, and Body) and sends it from that stored User to the User specified. There is a catch in case there is an error in the process, such as one of the Users not having an email listed.

Let us know how you use the Aras Scheduler Service, or what types of jobs you need to automate.

Looking for more Aras information?

Subscribe to our blog and follow @ArasLabs on Twitter for more helpful content! You can also find our latest open-source projects and sample code on the Aras Labs GitHub page.