Extender Activation Script
With Extender PU13 and above, you can add activation scripts to an Extender module to automate some tasks after importing an Extender module.
The activation script will be run after importing the module and logging into Sage 300 as ADMIN.
When to use
A very common use case is to run a script after importing a module to insert the required configuration records that support the module.
You can also run a script to validate certain values before importing a module and optionally prevent the import if the requirements are not met.
Example: The Workflow Module includes a workflow.activation script to insert records in the Workflow View Default table. Use to for example of what can be done in an activation script.
How to create an Activation script
The script needs to be called myModuleName.Activation.myDesc.py
When you create a new script in the Extender Scripts screen, if the name includes .activation. , Extender includes details about the available options.
Activation scripts options
# This script will be run after importing the module and logging into Sage
# as ADMIN.
# It MUST be called *.ACTIVATION.*
# eg "mymodule.activation.py"
from accpac import *
# int main(string args)
def main(args):
e = HostArgs()
e.parse(args)
op = e.getValue("op")
# op is:
# "install.before"
# The module is about to be installed.
# Returning non-zero will prevent installation.
#
# "install.after"
# The module was just installed.
# Any custom tables are not available yet.
#
# "install.restart"
# The module was installed and the desktop has been restarted.
# Custom tables are now available.
#
# "upgrade.before"
# The module is about to be installed.
# Returning non-zero will prevent installation.
#
# "upgrade.after"
# The module was just installed.
# Any custom tables are not available yet.
#
# "upgrade.restart"
# The module was installed and the desktop has been restarted.
# Custom tables are now available.
rvspyTrace("Activating module")
return 0
