You can write your own workflow script functions using the function
keyword.
Use parentheses to specify parameters for the custom function, and a block statement to
specify the operations that the function should perform. To execute the function, use the name
you assigned to it followed by the function call operator.
To try the sample below, you'll need the canIHasFunctions.fls.xml
trigger
webform.
"Hello World!"
Use the var
keyword inside the parentheses after the
function
keyword to set up the required parameters for your function when
you define it. When you call the function, use the function call operator to pass the required number of parameters to your function in the order
specified in the function
statement.
You can also set up a function as a member of an object and use the dot operator to access it.
When setting up a function member for an object, use the '$this'
keyword to refer to the object on which the function is
called.
server program iCanHasFunctions for form canIHasFunctions { var jedi = { name: "Luke", weapon: { name: "lightsaber", color: "green", sound: "vvvvvvuuwwwwooommmm" }, age: 21, fight: function() { trace "I'm " + '$this'.name + " and I'm wielding my " +'$this'.weapon.color
+ " " +'$this'.weapon.name
+"! " +'$this'.weapon.sound
+ " !!!"; } }; jedi.fight(); ... }