How to register scripts in Vertec
Scripts in vertec can be registered as module menu items, as event scripts or event scripts as modules.
This article is about registering scripts as menu items. Register Scripts on events or Scripts as modules can be found in the separate articles.
Administrator Rights rights are required to register scripts.
Under Settings > Reports & Scripts, right-click Scripts and select Neu > Scripteintrag
.
Activate the checkbox In Vertec Menüs anzeigen
:
Vertec versions before 6.7.0.12 do not have this checkbox yet. In this case, just read on.
designation |
Under this name, the script will appear later in the Actions menu, so make sure that the name is meaningful, but not too long. |
Platform |
Here you can specify which (code) language the script is in:
In Vertec versions before 6.6, this field does not yet exist. In this case, the script text must start with a # if it is a Python script. |
Classes |
Specify here the type of objects (classes) for which the script can be executed in Vertec. The menu item appears in the Actions menu (or in the context menu) only where it was registered for. If a class is not present in the selection, it can also be typed into the field by hand. Note that class names must be capitalized. Versions before 6.7.0.12: Valid are all Classes. Script cannot be registered to containers (folders). in Vertec Entry inheriting from the classVersions from 6.7.0.12 for scripts of a new type (see section ): All Classes in Vertec that inherit entry from the class are valid. Script can also be registered on containers (folders, Expression folders, link containers, etc.). |
Display condition |
Here you can specify a display condition as an OCL expression, with which you can control whether the script appears in the Actions menu (or in the context menu) or not. Click on the button with the three dots opens the Expression Editor. The result of this expression must return a Boolean Yes/No value. Only if the condition is met will the script appear in the Actions menu. Versions before 6.7.0.12The condition applies only to scripts on individual objects. Script configured to display on lists does not evaluate the condition. The OCL expression refers to the
Versions from 6.7.0.12For scripts of the new type (see section Changes since vertec version 6.7.0.12), the display condition refers to the list of selected objects (
|
Applicable to individual objects |
Vertec versions before 6.7.0.12. Check this box if the script can be applied to the individual object (e.g. on an invoice). For scripts registered before 6.7.0.12, this checkbox will be on the More Info page after updating to 6.7.0.12. See |
Applicable to lists (containers) |
Vertec versions before 6.7.0.12. Check this box if the script can be applied to a list of objects (e.g. to a project list). For scripts registered before 6.7.0.12, this checkbox will be on the More Info page after updating to 6.7.0.12. See Changes since vertec version 6.7.0.12 |
Extended user rights |
If registered scripts should later be able to be executed by users with restricted user rights, extended user rights can be accepted for the corresponding code locations. See the article Extended user rights in scripts. |
Script Text |
This is where the script code is inserted. See Code in scripts as menu items below. |
Executing... |
To run the script for testing purposes, click the Run button. Make sure that the current context must be correct in order to test a script in this way. Otherwise, you must run the test on the relevant entry using the Actions menu button. |
Script Editor... |
Opens the script, if it is a Python script, in the Script Editor. The Script Editor is then linked to the Script. This means that if you change code in the Script Editor, the script text in the script will also change. |
Scripts on individual objects can be done either via the Actions menu:
Or be executed via right-click:
Scripts on lists can be executed from the Actions menu or by right-clicking on the folder:
For scripts of the new type (see section Change since Vertec version 6.7.0.12), scripts can also be executed on selected objects:
If such a script is executed like a conventional list script via the Actions menu or by right-clicking on the container (folder), all entries of the list are passed:
The script code must be valid Python code (or deprecated VBScript) and the entire Vertec object model is accessible from the script.
The checkboxes Auf einzelne Objekte anwendbar
or Auf Listen (Container) anwendbar
removed from the main page of the script.
In Vertec Menüs anzeigen
on the main page. In this case, the new behavior applies (Code from vertec 6.7.0.12).The variable argobject
is not available in the script. Instead, there is the variable selectedobjects
. This contains the list of objects selected for the execution of the script:
currentobject
, which contains the container (folder).for obj in selectedobjects: ...
The variable argobject
returns the currently current object (the current entry) in Vertec.
projekt = argobject
currentobject
, which contains the parent container (folder).argobject.eintraege
callable. projektlist = argobject.eintraege for projekt in projektlist: ...