Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The parameters are a possibly empty, comma-separated list of variable names. All parameters can be assigned a default value.  More details can be found in Using Optional and Named Parameters

Zero or more declarations can be included to prepare data for the action block. More details can be found in Using Optional and Named Parameters. 

The action block is the same as the action block in a rule. Any action, including a user-defined action, can be used in the action block. Actions can be simple or compound. A simple action is a valid action block. For example, the following defines an action called send_warning using the event:send action:

...

User defined actions may also return values. The returned value may be a string, map, array etc. Consider the following from the pico-engine version 0.43.0example that returns a map:

Code Block
languagejs
themeConfluence
    deleteChild = defaction(pico_name){
      ent_children = children(){"children"}
      child_collection = ent_children.collect(function(child){
                                              (child{"name"} ==  pico_name) => "to_delete" | "dont_delete"
                                            })
      child_to_delete = child_collection{"to_delete"}.head()

      every {
        engine:removePico(child_to_delete{"id"})
      }
      returnsreturn
      {
        "updated_children": child_collection{"dont_delete"},
        "child": child_to_delete
      }
    }

...