2021-05-11:
Appended “Reaction associated with the discontinuation of Rhino, and the behavior result.”
Deleted suggestions of changing to Nashorn.
There are two types of automatic Steps in Questetra BPM Suite, which are: [Script Task] where you can define your own processing by writing ECMAScript codes, and [Service Task (Add-on)] which you can add to your workflow platform by importing.
(For [Service Task (Add-on)], there are Service Task Definitions published on the Questetra site and ones to be created by users.)
As of November 2020, “GraalJS”, “Nashorn” and “Rhino” are available in [Script Task] and [Service Task (Add-on)] as a script engine, but regarding Rhino, it is going to be discontinued at new version 13.1 on July, 2021.
The following forms of retrieving and updating process data that are available only in Rhino also will be deprecated.
- Retrieving: data.get(“1”)
- Updating: retVal.put(“1”, foobar)
Therefore, if you are using Rhino as the script engine in [Script Task] or [Service Task (Add-on)], please proceed with the following measures by June 30.
The version 12.3 of Questetra BPM Suite upgraded on 18th Jan. 2021 will be configured to cause an error in Workflow Apps that use Rhino. An error does not affect the operation of a running Workflow App, but you will need to fix the error when releasing a new version of the App.
Reaction associated with the discontinuation of Rhino, and the behavior result (appended 2021-05-11)
As of May 2021, if the latest version of a Workflow App includes a Step in which Rhino is used, a warning message (App definition error) will be displayed in the App details screen. Even if the warning is displayed, the script will work as before, without any run-time errors until Rhino support is completely discontinued. But it will behave as follows upon discontinuation.
- Script Task
- Script engine Rhino will be forcibly switched to GraalJS
- Depending on the code written, the behavior may change as follows:
- The Script Step results in an error (Processing failure)
- The Script Step ends normally, but the processing result differs
- The processing result will be the same as before
- Service Task (Add-on)
- Script engine setting is not changed (do nothing)
- If the value of the <engine-type> element is “0” or the element is undefined, the target Step will always result in a Processing failure
Script Task
Changing Script Engine
- Switch from “Rhino” to “GraalJS
/Nashorn” “GraalJS” is recommended in the long term- Since Nashorn” is deprecated in JDK 11, Questetra determined
also plansto discontinuein the near futureon October 2021
- Since Nashorn” is deprecated in JDK 11, Questetra determined
Modifying Script (code)
If your script uses the deprecated formats for data retrieving/updating or E4X for XML processing, you will need to modify your code.
- Change formats for data retrieving/updating
- Retrieve: data.get(“Data definition number”)
=> engine.findDataByNumber(“Data definition number”), engine.findDataByVarName(“field name”), etc. - Updating: retVal.put(“Data definition number”, value in format according to data type)
=> engine.setDataByNumber(“Data definition number”, value in format according to data type), engine.setDataByVarName(“field name”, value in format according to data type), etc. - The formats using “field name” are recommended
- Related information: R2301: Script Data Retrieving / Updating
- Retrieve: data.get(“Data definition number”)
- Change XML processing
- Changes to processing with XPath expressions instead of E4X
- Related information: R2300: Java Classes available in Script Task
- XPathWrapper
- XPathWrapper.NodeWrapper
- XPathWrapper.NodeListWrapper
Operational check
After changing the settings, conduct [Debug process execution] to check whether the App behaves as expected.
Even if you merely change the script engine, the operation may change depending on your code. If the behavior changes, modify the code.
Examples of code modifications
Here is a code example that reads the following XML in a String-type Data item and outputs the price/quantity element of the type = “Apple”.
<sales vendor="John">
<merchandise type="Orange" price="4" quantity="6"/>
<merchandise type="Apple" price="3" quantity="10"/>
<merchandise type="Peach" price="5" quantity="3"/>
</sales>
Before (Rhino): Formats of deprecated data retrieving/updating, E4X is used
var type = "Apple";
var xmlText = data.get("2");
var xmlObj = new XML( xmlText );
var price = xmlObj.merchandise.(@type == type).@price;
var quantity = xmlObj.merchandise.(@type == type).@quantity;
var outStr = "type: " + type + "\n" +
"price: " + price + "\n" +
"quantity: " + quantity;
retVal.put("0", outStr);
After (GraalJS): Formats of data retrieving/updating with Field name, XPath expression is used
const type = "Apple";
const xmlText = engine.findDataByVarName("q_xml_text");
const xpathType = "/sales/merchandise[@type='" + type + "']"
const node = xpath.findNode(xmlText, xpathType);
const price = xpath.findNodeText(node, "@price");
const quantity = xpath.findNodeText(node, "@quantity");
// Retrieve texts directly
// const price = xpath.findNodeText(xmlText, "/sales/merchandise[@type='" + type + "']/@price");
// const quantity = xpath.findNodeText(xmlText, "/sales/merchandise[@type='Apple']/@quantity");
let outStr = "type: " + type + "\n" +
"price: " + price + "\n" +
"quantity: " + quantity;
engine.setDataByVarName("q_xpath_output", outStr);
Data type conversion
Whereas Nashorn performs implicit (automatic) type conversions, GraalJS requires explicit type conversions (casting).
For example, if there is a part where a numerical value is specified as an argument (unknowingly) in queryParam / formParam of HttpRequestWrapper, an error will occur in GraalJS so it needs to be corrected.
const limitNum = 1000;
httpClient.begin().queryParam("limit", limitNum); //before
↓
httpClient.begin().queryParam("limit", String(limitNum)); //after
Service Task (Add-on) -Service Task definition (Add-on XML)-
Service Task Definition files (Add-on XML) have been registered in either of the following sections.
- Service Task Definition unique to Apps
- Detail > ▼App > Manage Add-on > Definition of service task
- App Administrator Authorization of the target App is required
- App- shared Service Task Definition
- System settings > App-shared Add-on> Definition of service task
- System Administrator Authorization is required
In the registered Addon-XML file, if the value of &lit;engine-type> element is 0 (Rhino), or if the element is undefined, you need to modify it.
There are several ways to handle the Service Task definition, so please consider a suitable method for your environment.
a. Replace with the standard Modeling Elements
If the function of the Service Task definition you are using is equivalent to the provided modelling element, we recommend that you replace it with a modelling element in the workflow diagram.
- Standard Modelling elements: R2010: List of Modelling Elements
- Modelling elements are added to the standard one after another
- Some of the Service Task definitions which were previously published as add-ons have now become standard modelling elements
b. Replace with new Service Task Definitions
If a new version of Service Task Definition is published, download a new Addon-XML file then update the existing add-on file, or register it separately and replace it in a workflow diagram.
- Service Task Definition: Add Automatic Processing Process (Addon)
- In the retrieved Addon-XML file, confirm that the value of <engine-type> element is
either “1” (Nashorn) or“2” (GraalJS) - Operational specifications of Service Task Definitions may be changed. Please check if it meets your purpose
- If you update the existing Service Task Definition file, it will affect the operation of the running App
- In the retrieved Addon-XML file, confirm that the value of <engine-type> element is
c. Edit Service Task Definition (Add-on XML) to update
In the case of your own Service Task Definition, or the measures mentioned in the a/b sections are not available, you should edit and update the Addon-XML file by yourself.
- Related information: M416: Create your own Auto-Step for Business Process Definitions
Changing Script Engines
- Change the value of <engine-type> element to 2 (GraalJs)
or 1 (Nashorn)- <engine-type>2</engine-type>
- If <engine-type> is not set, add it
Modifying Script (codes)
If your code in the <script> element uses an obsolete format for data retrieving /updating or uses E4X for XML processing, you need to modify the code.
See “Modifying Scripts (Code)” in the “Script Tasks” section above for how to modify.
We apologize for your inconvenience, but we would appreciate it if you could prepare for and deal with the deprecation of Rhino.
Pingback: v12.3 2021-01-18 Added Auto-step that Cooperates with kintone – Questetra Support
Pingback: Script Task – Questetra Support
Pingback: Google Group Members Retrieve – Questetra Support
Pingback: Google Spreadsheets Cell Value Update – Questetra Support
Pingback: Google Group Member Add – Questetra Support
Pingback: Google Group Member Deletion – Questetra Support
Pingback: Google Analytics Reports (PV ranking) – Questetra Support
Pingback: Google Analytics Reports (Domain ranking) – Questetra Support
Pingback: Google Analytics Reports (Referrer ranking) – Questetra Support
Pingback: Submit Print Job via GCP Service (Single) – Questetra Support
Pingback: Salesforce: Create Order – Questetra Support
Pingback: Batch Acquisition of Salesforce Customer Data – Questetra Support
Pingback: Box File Upload (Password / Expiration) – Questetra Support
Pingback: kintone Batch Acquisition of Two Columns of Data – Questetra Support
Pingback: Post Message through LINE Notify – Questetra Support
Pingback: Backlog Add Issue – Questetra Support
Pingback: PayPal Invoicing Create (JPY) – Questetra Support
Pingback: PayPal Invoicing Create (USD) – Questetra Support
Pingback: PayPal Invoicing Status – Questetra Support
Pingback: PayPal Invoicing Send – Questetra Support
Pingback: Twilio FAX Send – Questetra Support
Pingback: Questetra Role Membership Add – Questetra Support
Pingback: Questetra Role Membership Delete – Questetra Support
Pingback: Questetra Org Membership Add – Questetra Support
Pingback: Questetra Org Membership Delete – Questetra Support
Pingback: NHK Program Search – Questetra Support
Pingback: Email a Excel-CSV (Table) SJIS – Questetra Support
Pingback: Single Value from a JSON object using JSONPath – Questetra Support
Pingback: Check The User Is In The Organization – Questetra Support
Pingback: Ver.12.3.1 2021-02-07 API Updated the Java Library of API Client – Questetra Support
Pingback: Ver.13.0 2021-04-11 Automatic Process Start Kicked by Appointment on Google Calendar – Questetra Support
Pingback: Notice Concerning Deprecation of Nashorn (September 2021) – Questetra Support
Pingback: Ver.13.1 2021-07-11 HTML Emails are Now Available – Questetra Support