Rapid Modelling and Testing
Valid for: version 4
This page describes how to use a script to rapidly activate a deployed workflow model.
Introduction
When creating workflow models, frequent tests are often necessary. The process of deploying a new version of a workflow model on the test system, assigning it to a model group and activating it takes only seconds in management-studio, but may be costly when repeated several times per hour.
The same actions can be automated with the help of a script. A sample PowerShell script is presented on this page.
Note
This script is not a part of the product and is not officially supported. The script utilizes non-public REST API methods that may change without prior notice. This page will be updated in case of API changes, but the maintenance of the script and its derivatives in the field stays with its users.
Usage
Scope
This script assigns a model that is already deployed to the process model In-tray to the given model group, and then activates the model.
If multiple models in the target system's in-tray have the same name, the script will exit.
If the given model group already contains a model with the same name as the requested model, the script will exit.
The script uses REST calls to communicate with the target system. If the target system returns an error status code, the error details are printed on the command line.
Preconditions
To execute the script, only Windows PowerShell is required. Since PowerShell is installed by default on every modern Windows operating system, no further preparation is necessary.
Executing the Script
The script includes a help with definitions of parameters, commands and functions. A brief summary is presented below.
For more information about Windows PowerShell, click here.
The script can be downloaded at the bottom of this page.
Basic
Open a PowerShell and run the following command.
.\ActivateWorkflowModel.ps1 -targetSystemIp "<target system IP address>" -targetSystemPort "<target system port>" -modelName "<model name>" -groupName "<target model group name>" -userName "<user name>" -password "<password>"
.\ActivateWorkflowModel.ps1 -targetSystemIp "127.0.0.1" -targetSystemPort "8080" -modelName "myModel" -groupName "myGroup" -userName "roger" -password "rabbit"
Advanced
The script supports default values for each script parameter. Setting default values for script parameters that are often constant, such as the target system's IP address and port number, allows for more efficient testing.
To set default values for script parameters, open the script with Windows PowerShell ISE or a simple text editor. Enter default values as needed in the parameter definition section at the top of the script, then save it.
#################### parameter definition ############################ Param ( [Parameter(Mandatory=$false)] [string]$targetSystemIp = "127.0.0.1", [Parameter(Mandatory=$false)] [string]$targetSystemPort = "8080", [Parameter(Mandatory=$false)] [string]$modelName = "", [Parameter(Mandatory=$false)] [string]$groupName = "myTestGroup", [Parameter(Mandatory=$false)] [string]$userName = "roger", [Parameter(Mandatory=$false)] [string]$password = "" ) #################### end of parameter definition #####################
To execute a script that has default values defined for one or more parameters, the basic command can be reduced to those parameters that are not set:
.\ActivateWorkflowModel.ps1 -modelName "myModel" -password "rabbit"
If a parameter is provided, its value will overwrite the corresponding default value in the script.
Help
To see all help information, run the following command in PowerShell:
Get-Help .\ActivateWorkflowModel.ps1 -full
Script Version History
Script Version | Date | Compatible core-service version | Author | Description | Download |
---|---|---|---|---|---|
1.2 | 18th Aug 2023 | 9.5 or newer | A-Team | Due to a bug fix in core-service 9.5, the internal endpoint PUT bpm/management/model/{modelId}/info does not support changing the parentId anymore. The endpoint POST bpm/management/model/{modelId}/move has to be used to move models. | |
1.1 | - | <= 9.4 | - | - |