Housekeeping scripts
Introduction
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
<housekeeping>
<!-- Site-specific housekeeping scripts, do not change without consulting Octosoft support first. -->
<scripts>
<script language="SQL" name="MyScript" run="before">
.... SQL Commands ....
</script>
<script language="SQL" name="MyOtherScript" run="after">
.... SQL Commands ....
</script>
<script language="OctoUtil" name="MyExportScript" run="export">
.... OctoUtil Commands ....
</script>
</scripts>
</housekeeping>
Elements
script
<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 - run at the beginning of full and partial housekeeping cycles. |
after | run this script at the end of housekeeping but before Organization mapping - full and partial housekeeping cycles. |
export | run this script at the very end of a full housekeeping cycle. |
beforeImport | run this script at the beginning of an import batch |
afterImport | run this script at the end of an import batch |
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 or software installation approval.
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.