Versions Compared

Key

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

...

Microbizz logs various script related things in the System log.


Microbizz.Log("The script was started")
// first argument should be a string, second argument is optional and may be an array or dict or string or number
Microbizz.Log("Some data", [123,"ABC"])

Example 10 - logging

Sandbox

You may test the plugins/scripts by running them in a simple "sandbox", which prevent certain functions for doing anything; there is a Run in sandbox checkbox in the script editor for this.

...

taxrule = Tax.getRule(this.zip, this.createdate)
return Tax.calculate(this.price, taxrule)

Example 10 11 - unrealistic extension

Real world examples

...

cus = this.customer
if cus.indb()
  this.sv("custom123", cus.custom321)
  this.save()

Example 11 12 - copy custom field

Copy a custom field from a project task to all subtasks whenever the project task is saved

...

if this.tasktype == 5 && this.parenttodo == 0
subtodos = this.subtodos
if isarray(subtodos)
for id in subtodos
todo = Microbizz.GetTodoByID(id)
todo.sv("custom322", this.custom321)
todo.save()

Example 12 13 - copy custom field

Known problems

...