The JavaScript activity acts like an Assign activity that enables you to use JavaScript (E4X), rather than using XPath 1.0. In many cases JavaScript can perform the same logic as XPath with much fewer processes.
Drag the JavaScript element from the Palette to the diagram. The JavaScript activity is added to the diagram and an empty extension assign operation is added to the source.
Double-click the JavaScript element in the diagram to open the JavaScript Editor. From the editor you can assign input and output expressions, and add your JavaScript code to the editor's text field.
The JavaScript Editor's Input button opens a dialog box to specify the input mapping between BPEL and JavaScript variables.
In the same way, the editor's Output button opens another dialog box to specify the output mapping between JavaScript and BPEL variables.
The Properties window of the Assign element, invoked by right-clicking the element and choosing Properties, contains two properties:
Name: The name of the element.
Validate: Specifies whether the JavaScript (Assign) activity validates any variables modified by the activity. When the value is “yes” , the activity will validate all of the variables it modifies. If the validation fails because one of the variables is invalid to its corresponding XML definition, then a standard fault bpel:invalidVariables is thrown. The default value is N/A.
Documentation: User documentation attached to the element. This documentation is included with the source code of the BPEL process and can be extracted and included in a report.