Difference between revisions of "Script Callout"
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
m (BeanShell Callout moved to Script Callout: Added support for more scripting languages) |
(more scripting explanation) |
||
Line 1: | Line 1: | ||
− | Status: | + | Status: working in version > 3.3.1b<br> |
+ | |||
Contributed by:<br> | Contributed by:<br> | ||
Quality Systems & Solutions - QSS Ltda.<br> | Quality Systems & Solutions - QSS Ltda.<br> | ||
[[User:CarlosRuiz|Carlos Ruiz]] | [[User:CarlosRuiz|Carlos Ruiz]] | ||
+ | |||
+ | Improvements by:<br> | ||
+ | E-Evolution<br> | ||
+ | [[User:vpj-cd|Víctor Pérez]]<br> | ||
+ | make it work with any java scripting language [https://scripting.dev.java.net https://scripting.dev.java.net] | ||
+ | |||
== Create the Rule == | == Create the Rule == | ||
Line 15: | Line 22: | ||
** ___Value | ** ___Value | ||
** ___OldValue | ** ___OldValue | ||
+ | |||
+ | Actually just Callouts of type are implemented JSR 223 Scripting APIs. In future there are plans to implement more events and types. | ||
+ | |||
+ | In standard Adempiere were uploaded jars to work with [http://groovy.codehaus.org/ groovy], [http://www.jython.org/Project/index.html jython] and [http://www.beanshell.org/ beanshell] | ||
[[Image:01_BeanShell.png]] | [[Image:01_BeanShell.png]] | ||
Line 21: | Line 32: | ||
[[Image:02_BeanShellCallout.png]] | [[Image:02_BeanShellCallout.png]] | ||
+ | |||
+ | |||
+ | == Code provided for copy/paste testing == | ||
+ | |||
+ | On the Table and Column, callout reference: | ||
+ | @script:beanshell:BP_fillDescriptionFromName | ||
+ | |||
+ | On the Rule Search Key: | ||
+ | beanshell:BP_fillDescriptionFromName | ||
+ | |||
+ | On the Rule Script: | ||
+ | if (___Tab.getValue("Name") != null) { | ||
+ | ___Tab.setValue("Description", ___Tab.getValue("Name")); | ||
+ | } | ||
+ | result = ""; |
Revision as of 15:33, 24 January 2008
Status: working in version > 3.3.1b
Contributed by:
Quality Systems & Solutions - QSS Ltda.
Carlos Ruiz
Improvements by:
E-Evolution
Víctor Pérez
make it work with any java scripting language https://scripting.dev.java.net
Create the Rule
Within the script you can use:
- Window context variables start with a single underscore _
- Login context variables start with two underscores __
- Parameters for callout start with three underscores ___
- ___WindowNo
- ___Tab
- ___Field
- ___Value
- ___OldValue
Actually just Callouts of type are implemented JSR 223 Scripting APIs. In future there are plans to implement more events and types.
In standard Adempiere were uploaded jars to work with groovy, jython and beanshell
Configure the callout
Code provided for copy/paste testing
On the Table and Column, callout reference:
@script:beanshell:BP_fillDescriptionFromName
On the Rule Search Key:
beanshell:BP_fillDescriptionFromName
On the Rule Script:
if (___Tab.getValue("Name") != null) { ___Tab.setValue("Description", ___Tab.getValue("Name")); } result = "";