Request for Script Changes for Deprecated Methods

Questetra has two types of automatic steps. [Script Task] allows users to write their own scripts (ECMAScript) and define their own original processing. Another Add-on automatic step [Service Task (Add-on)] can be used if you import it. (Both available in Professional Edition)

In these automatic steps, the script (code) is processed by the JavaScript engine (Script Engine). Script Engine has the great feature of being able to access functions implemented in Java. Using this, Questetra’s workflow engine, implemented in Java, can be accessed utilizing JavaScript syntax.

Deprecation of Java Classes/Methods

The Java classes and methods available for [Script Task] and other tasks are listed in the Reference (R2300), but some classes/methods may become obsolete due to Questetra development and improvements. 

Classes and methods that are scheduled to be deprecated are announced through Version Info, and usually there is a grace period of one year or more before they actually become obsolete. Because of this, you have some time between the announcement of the deprecation schedule and the actual deprecation

How to find obsolete Classes/Methods

[Warn] will be output to the Process Log when a method scheduled to be deprecated is executed. This warning log will help you identify the target workflow app or automatic step and modify the script.

System administrators can search/list the process log from [System Settings]>[Process Log]. If you enable “Only logs with warnings” in the filter criteria, only warnings will be listed. You can further refine your search by adding the target application and date criteria.

You can check the details (log messages) of each log by clicking on the (i) mark in the list. If a method that is scheduled to be deprecated is used, log messages of the following format beginning with [Warn] are output.

[Warn] XXX() has been deprecated. Use YYY() instead.

The app names and the step names are also recorded in the logs. The workflow app and target automated steps that need to be modified can be identified in the process log.

If you are not the system administrator but the application administrator of a workflow app, ask the system administrator to check for [Warn] notifications. Alternatively, please check the automated steps processing log in the “Administrator mode” of the app details screen (requires [Process Manager]).

[Warn] notification is displayed not only for classes/methods that are scheduled to be deprecated, but also when the Script Engine that is being deprecated is executed. In addition, [Warn] may also be output in automated steps other than Script Tasks and Service Tasks (Add-on).

Please refer to the following article regarding the discontinuation of the “GraalJS (Nashorn Compatible Mode)” Script Engine.

Correspondence for Script Engine GraaIJS (Nashorn Compatible Mode) Abolition (April 2024)

How to deal with Obsolete Classes/Methods

Once you have identified the workflow App that needs to be modified and the target automated steps, modify the script for the steps. Warning logs indicate which methods are obsolete and (usually) which methods are successors, so use this information to rewrite the code.

Information on each Java method can be found in the reference (R2300).

If an unmodified script is executed after classes/methods have been completely deprecated, the automated step in question will result in a runtime error. Periodically check for [Warn] notifications and take appropriate action before complete deprecation.

Example of code changes

For example, if the operation of creating an empty table generates the following warning log, replace the process using ListArray() with code that uses createListArray().

[Warn] new com.questetra.bpms.core.model.formdata.ListArray() has been deprecated. Use createListArray() instead.

  • Method (class) to be deprecated
    • com.questetra.bpms.core.model.formdata.ListArray
      • ListArray() is the constructor of the ListArray class, which is going to be deprecated
  • Succession method (class)
    • ScriptListArray ProcessDataDefinitionView.createListArray()
      • Generate an empty table (empty ScriptListArray object) if it is a table type
//Before code change
let newtable = new com.questetra.bpms.core.model.formdata.ListArray();

//After code change
const tableDataDefinition = engine.findDataDefinitionByVarName(“q_table”);
let newTable = tableDataDefinition.createListArray();

In this example, the process of calling the constructor of the ListArray class to create its instance is replaced by the process of creating an empty ScriptListArray object using ProcessDataDefinitionView.createListArray() to create an empty ScriptListArray object. The method of handling this depends on the method to be eliminated, so please check the documentation and change the code appropriately.

After changing the script, use [Debug execution] or [Debug only this node] to check if the script works as expected.

Handling of Add-on Automatic Steps

If the target automated step is an Add-on automated step, updating the registered service task definition file (Add-on-XML) is necessary. Please modify the Add-on-XML file or obtain the new version of the definition file and update the registered definition file. The definition file is registered in one of the following:

  • App-specific service task definition:
    • (App Details Screen) > ▼ App > Add-on Management > Service Task Definition File
    • Requires [App Administration Permissions] for the target app
  • App-shared service task definition:
    • System Settings > App Shared Add-on > Service Task Definition File
    • Requires [System Administration Permissions].

For automated steps utilizing deprecated classes/methods for which warning logs are being generated, please update the script (code) accordingly.

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version