Beanshell Scripting with Enactor Application Process Editor
Inputs
To pass an input variable to a BeanShell script, follow these steps:
-
Add the input to the Action using the Application Editor.
-
Reference the input in your BeanShell script using the following convention:
- Trim the input at the last dot (.)
- Take the last segment
- Convert the first letter to lowercase
Example:
If the input is enactor.mfc.Basket
, you would reference it in the script basket
.
Outputs
To send a variable as output from a BeanShell script, follow these steps:
-
Add the output to the Action using the Application Editor.
-
Match the output name with the corresponding script variable:
- Use the script variable name as the last segment of the output path
- Capitalize the first letter of the script variable when defining the output
Example:
If your script defines a variable basketItem
, the output variable can be named enactor.mfc.BasketItem
Outcomes
You can define outcomes in the beanshell script as
Outcome = “Success”
;
Then you can add Outcomes to the Action using the Application Process Editor.
Static Libraries
You can use functions provided by the Enactor Static Libraries within your scripts.
Locating Static Library Classes
To view the methods available in static library functions:
-
Double-click a link connecting two actions in an existing process.
-
Expand the Functions section to browse library methods, organized by category.
To use a method from a static library in your script:
- Select the relevant class for your static library from the table given below.
Function Name | Classname |
---|---|
client | com.enactor.coreUI.pageDefinition.ClientSideFunctionMapper |
convert | com.enactor.coreUI.el.ConvertFunctionMapper |
crpyto | com.enactor.core.cryptography.CryptographyUtils |
database | com.enactor.core.listFilters.DatabaseFunctionMapper |
dates | com.enactor.core.utilities.DateUtils |
com.enactor.coreUI.mail.EmailFunctionMapper | |
encode | com.enactor.core.utilities.EncodeUtils |
filter | com.enactor.core.listFilters.DatabaseFunctionMapper |
format | com.enactor.coreUI.format.DataFormatterFunctionMapper |
group | com.enactor.mfc.group.el.GroupFunctionMapper |
name | com.enactor.coreUI.format.DataFormatterFunctionMapper |
pagedef | com.enactor.coreUI.el.PageDefinitionFunctionMapper |
priv | com.enactor.coreUI.el.PrivilegesFunctionMapper |
script | com.enactor.coreUI.el.ScriptFunctionMapper |
simple | com.enactor.core.el.CoreApplicationProcessFunctionMapper |
strings | com.enactor.core.utilities.StringUtils |
xml | com.enactor.core.el.CoreApplicationProcessFunctionMapper |
-
Import the required class at the top of your script.
-
Call the desired method from the imported class.
For example, to concatenate two strings:
Required function - Simple functions
Relevant classname - com.enactor.core.el.CoreApplicationProcessFunctionMapper
Therefore, the script should be,
import com.enactor.core.el.CoreApplicationProcessFunctionMapper;
message = CoreApplicationProcessFunctionMapper.concat("Hello ", name);