Versions Compared

Key

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

...

The following types are supported:

TypeExplanationExamples
stringText is always in UTF-8, use double quotes "  "headline = "Microbizz script"
numberThe decimal point is . (full stop)price = 12.34
arrayThis is a comma seperated list of values, types may be mixed

myarray = [1, 2, 3,"Some text", [4, 5, 6]]

sometext = myarray[4]

dictA 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 objectDocumentationList of connected objects
CustomerMicropedia - the "customer" object

this.person

this.user

EdiInvoiceMicropedia - the "edi" object

this.todo

this.user

this.customer

EquipmentMicropedia - the "tool" object

this.placeofhome

this.user

InvoiceMicropedia - the "invoice" object

this.user

this.customer

InvoiceLineMicropedia - the "invoiceline" object

this.todo

this.customer

PersonMicropedia - the "person" object
ProjectMicropedia - the "project" objectthis.user
RegistrationMicropedia - the "registrationentry" object

this.todo

this.user

this.customer

TaskMicropedia - the "todo" API object

this.customer

this.user

this.project

UserMicropedia - the "user" object
ProductMicropedia - the "product" object
SalesContractMicropedia - the "salescontract" object

this.customer

this.user

EventMicropedia - 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.

...