Automation

Use JavaScript, an easy programming language to automate your processes.
Examples:
- Send an email
- Perform database operations
With a minimum of program code you can string together your processes.
Please login first to try out the examples:
Send an email
Here you see the master data form. When a new page is inserted, an email is send to the logged in user.
filename: kitsamples/pagesemail/pagesemail.js
Event
"cbAfterSave" is the event of the master data element after having saved the record.
Condition
The value "bnew" is true, when a new record was inserted.
Configuration
The object dat_email is configured like this:
- to: receiver of the email
- subject: new page
- content: the link to new record is embedded
- url: the url to Start the PHP Mailer
Action
The url is called and the result is displayed:
- bok: message "send"
- else: error by sending the message
- error by communication with the web server
Database operations
The catalog example is extended with a basket. Each item can be placed in the shopping basket with the desired count. The count for each user and item is stored in the table: er_basket.
Each item has the basket with the following elements:
- count
By clicking on the - / + button the event is started.
Each time the record is written to the table: er_basket, the count is updated.
filename: kitsamples/basketcomponents/basketcomponents.js
Event
"cbcatLoad" is the event after displaying the catalog entry. The eventlisteners on click for the + and - buttons are added. The function "updateBasket()" is called by each buttom to start the action.
Condition
Here are no conditions necessary.
Configuration
The object dat_basket is configured like this:
- currentID: Primary key of the table er_basket
- foreignID: correspondent to componentID, primary key of table k8components
- quantity: count of the item in the basket
- the creatorID, ID of the logged in user (userID), is added in the back end
Action
The url is called and the record is written to the database. By success:
- the count is updated
- the variables for "quantity" and "currentID" are updated