Difference between revisions of "Script Callout"

From iDempiere en
(→‎See Also: more links)
(edit for readibility and more elegant advertising :-))
Line 1: Line 1:
Status: working in version > 3.3.1b<br>
+
=Status=
 
+
* Testing for Next Release 340 - January, 2008<br>
Contributed by:<br>
+
*A real huge contribution from [[User:CarlosRuiz|Carlos Ruiz]], Quality Systems & Solutions - QSS Ltda., [[Colombia]]
Quality Systems & Solutions - QSS Ltda.<br>
+
*Now it can work with any java scripting language such as Groovy and Jython, thanks to [[User:vpj-cd|Víctor Pérez]], E-Evolution, [[Mexico]]
[[User:CarlosRuiz|Carlos Ruiz]]
+
 
+
= Creating the Rule =
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 ==
 
  
 
Within the script you can use:
 
Within the script you can use:
Line 23: Line 16:
 
** ___OldValue
 
** ___OldValue
  
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]]
  
== Configure the callout ==
+
= Configure the callout =
  
 
[[Image:02_BeanShellCallout.png]]
 
[[Image:02_BeanShellCallout.png]]
  
  
== Code provided for copy/paste testing ==
+
= Sample Code provided for copy/paste testing =
  
 
On the Table and Column, callout reference:
 
On the Table and Column, callout reference:
Line 45: Line 37:
 
  }
 
  }
 
  result = "";
 
  result = "";
 +
 +
=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]
 +
*to call a script from a ''Callout'' now you can follow this syntax:
 +
**@script:beanshell:ValidateQtyOnHand
 +
**@script:groovy:ValidateQtyOnHand
 +
**@script:jython:ValidateQtyOnHand
 +
 +
*Note: When you create the rule, you have to set in the ''Search Key'' box with the respective rule:
 +
**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''
  
 
=See Also=
 
=See Also=

Revision as of 03:41, 26 January 2008

Status

  • Testing for Next Release 340 - January, 2008
  • A real huge contribution from Carlos Ruiz, Quality Systems & Solutions - QSS Ltda., Colombia
  • Now it can work with any java scripting language such as Groovy and Jython, thanks to Víctor Pérez, E-Evolution, 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


01 BeanShell.png

Configure the callout

02 BeanShellCallout.png


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 now you can follow this syntax:
    • @script:beanshell:ValidateQtyOnHand
    • @script:groovy:ValidateQtyOnHand
    • @script:jython:ValidateQtyOnHand
  • Note: When you create the rule, you have to set in the Search Key box with the respective rule:
    • 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

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.