Difference between revisions of "Script Callout"
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
m (→Scripting Languages) |
m (→Scripting Languages) |
||
Line 40: | Line 40: | ||
=Scripting Languages= | =Scripting Languages= | ||
*Now standard Adempiere has uploaded jars to work with [http://groovy.codehaus.org/ groovy], [http://www.jython.org/Project/index.html jython] and [http://www.beanshell.org/ beanshell] | *Now standard Adempiere has uploaded jars to work with [http://groovy.codehaus.org/ groovy], [http://www.jython.org/Project/index.html jython] and [http://www.beanshell.org/ beanshell] | ||
− | *to call a script from a ''Callout'' | + | *to call a script from a '''Callout''' follow these sample syntax: |
**@script:beanshell:ValidateQtyOnHand | **@script:beanshell:ValidateQtyOnHand | ||
**@script:groovy:ValidateQtyOnHand | **@script:groovy:ValidateQtyOnHand | ||
**@script:jython:ValidateQtyOnHand | **@script:jython:ValidateQtyOnHand | ||
− | * | + | *When you create the rule, you have to set in the '''Search Key''' such as: |
**Search Key : beanshell:ValidateQtyOnHand | **Search Key : beanshell:ValidateQtyOnHand | ||
**Search Key : groovy:ValidateQtyOnHand | **Search Key : groovy:ValidateQtyOnHand | ||
**Search Key : jython:vValidateQtyOnHand | **Search Key : jython:vValidateQtyOnHand | ||
− | *Set the Event Type as ''Callout'' and Rule Type as ''JSR 223 Scripting APIs'' | + | *Set the '''Event Type''' as ''Callout'' and '''Rule Type''' as ''JSR 223 Scripting APIs'' |
=See Also= | =See Also= |
Revision as of 18:49, 25 January 2008
Contents
Status
- Testing for Next Release 340 - January, 2008
- A real huge contribution from Carlos Ruiz, Quality Systems & Solutions (QSS), Colombia
- Now it can work with any java scripting language such as Groovy and Jython, thanks to Víctor Pérez, E-Evolution (Libero), Mexico
Creating 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
Configure the callout
Sample 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 = "";
Scripting Languages
- Now standard Adempiere has uploaded jars to work with groovy, jython and beanshell
- to call a script from a Callout follow these sample syntax:
- @script:beanshell:ValidateQtyOnHand
- @script:groovy:ValidateQtyOnHand
- @script:jython:ValidateQtyOnHand
- When you create the rule, you have to set in the Search Key such as:
- Search Key : beanshell:ValidateQtyOnHand
- Search Key : groovy:ValidateQtyOnHand
- Search Key : jython:vValidateQtyOnHand
- Set the Event Type as Callout and Rule Type as JSR 223 Scripting APIs