...
The following types are supported:
Type | Explanation | Examples |
---|---|---|
string | Text is always in UTF-8, use double quotes " " | headline = "Microbizz script" |
number | The decimal point is . (full stop) | price = 12.34 |
array | This is a comma seperated list of values, types may be mixed | myarray = [1, 2, 3,"Some text", [4, 5, 6]] sometext = myarray[4] |
dict | A list of key:value pairs, the syntax is much like the Javascript object syntax, or JSON | peter = {name: "Peter", age: 15, height: 160} age = peter.age age = peter["age"] |
object | title = this.title today = Date.date() | |
data |
Expressions
Expression syntax is pretty standard. The operators are described below.
Variables are assigned using =. Variables can be updated using += or -= etc.
Operators | |
---|---|
* / % ^ | Arithmetic; notice that it is valid to divide by 0 |
+ - | Arithmetic, but + also works for strings and arrays |
|| && | & ^ | Boolean and bitwise |
== != < <= >= > === !== | Comparisons, the result is 0 or 1 |
. | Object access |
(bool) (number) (array) (string) (int) | Cast, convert a value to another type of value |
! | Logical negation |
= += -= *= /= &= |= ^= | Assignment |
Controls structures
The if
-elseif
-else
and while
control structures are supported. while
supports break
and continue
.
...
The built-in functions are described here: Microbizz script - functions
Many of the functions are accessed through objects like the Date
object, which provides functions like Date.time()
and Date.date()
, or the Math
object which provides functions like Math.max()
and Math.round()
. Other functions are accessed as properties of variables, like "this is a string".length()
.
...
F.ex. if the script is run to generate the value for a task custom field, the context is the task. The context is accessed through the object named this
. Refer to the API documentation for details about the various objects. Some objects allow you to easily access other objects that are somehow connected, e.g. if this
is a ask, then this.user
is the responsible user for the task.
Microbizz object | Documentation | List of connected objects |
---|---|---|
Customer | Micropedia - the "customer" object | this.person this.user |
EdiInvoice | Micropedia - the "edi" object | this.todo this.user this.customer |
Equipment | Micropedia - the "tool" object | this.placeofhome this.user |
Invoice | Micropedia - the "invoice" object | this.user this.customer |
InvoiceLine | Micropedia - the "invoiceline" object | this.todo this.customer |
Person | Micropedia - the "person" object | |
Project | Micropedia - the "project" object | this.user |
Registration | Micropedia - the "registrationentry" object | this.todo this.user this.customer |
Task | Micropedia - the "todo" API object | this.customer this.user this.project |
User | Micropedia - the "user" object | |
Product | Micropedia - the "product" object | |
SalesContract | Micropedia - the "salescontract" object | this.customer this.user |
Event | Micropedia - the "event" object | this.user this.customer |
Script return value
When the script is run to generate the value for a custom field, the return value is specified by the keyword return
outside of a function, this will also stop execution of the script; the return value is what is displayed in Microbizz.
...