Housekeeping Scripts


The import service provides several hooks to implement custom SQL and/or OctoUtil scripts. Such scripts can be useful for integrating with other systems or to transform custom data within the database. Writing housekeeping scripts requires thorough knowledge of the OctoSAM data model.

Administering Scripts

The scripts can be modified using the OctoSAM GUI, menu: Setup - Database - Housekeeping - Scripts

  <!-- Site-specific housekeeping scripts, do not change without consulting Octosoft support first. -->
    <script language="SQL" name="MyScript" run="before">
        .... SQL Commands ....
    <script language="SQL" name="MyOtherScript" run="after">
         .... SQL Commands ....
    <script language="OctoUtil" name="MyExportScript" run="export">
         .... OctoUtil Commands ....



script Element

<script name="myscript" language="SQL" run="before" />

The <script> element defines a script

Attribute Required Default Value Description
language Y either SQL or OctoUtil
run Y When to run the script - see table below
name Y Name of the script. Use the name to identify the script in log and error messages
Run Description
before run this script at the very beginning of a housekeeping cycle
after run this script at the end of housekeeping but before Organization mapping
export run this script at the very end of a housekeeping cycle
beforeImport run this script at the beginning of an import batch
afterImport run this script at the end of an import batch

Script Types

SQL Scripts

Can be used to execute arbitrary Transact SQL Commands. Use extreme care not to destroy data. Typical use is to transform site specific data within the database, often in the context of Organization mapping.

OctoUtil Script

Allows to execute OctoUtil commands - especially the execute and the query commands in sync with the import service. This guarantees that the database is in a consistent state when the commands are executed. The OcotoUtil query command is typically executed at export time.

Note that the housekeeping scripts are executed under the service account, which might have different permissions from your interactive user.