Enterprise Application Development

Fast Modeling, Responsive Design, One-Button Deploy

BOOK a Demo

Economic theory-based business modeling

Resources, Events, Agents

BOOK a Demo
OMNIA – Low-Code Business Application Development Platform

New UI Behaviour: Before Collection Entry Initialize
Posted February 18th, 2021

New UI Behaviour: Before Collection Entry Initialize
Posted February 18th, 2021

On a previous post we’ve introduced the Collection Entry Initialize Behaviour for the server side. Now we are happy to announce this behaviour is also available as a User Interface Behaviour.

In case you don’t remember what is this “Collection Entry Initialize” don’t worry. We explain. The Collection Entry Initialize is a Server-side Behaviour that is executed when a new entity is added to a collection, before the execution of the new entry initialize behaviour. The new improvement brings this behaviour to the user interface side, where it is coded using Javascript. This enables you to include, on the new created line, information that is only avaliable on the user’s device.

On today’s example, we have a document that represents a daily delivery trip report. We want the driver to update the trip report with his mobile device every time he delivers a package. With the use of a Before Collection Entry Initialize UI Behaviour, we can help the driver by automatically filling in each package delivery time and location (by using the device’s clock and geo-location information):

As visible on the example above, when the user clicks the “Add new” button on the grid footer, a new entry is added to the collection already with the values of time, location and package code prefix set. Let’s check out the (javascript) code:

return new Promise((resolve)=>{
	navigator.geolocation.getCurrentPosition((position)=>{
		entry.location = `${position.coords.latitude};${position.coords.longitude}`;
		entry.time = new Date().toLocaleTimeString('en-US', { hour12: false });
		entry.packageCode = "F.1000.";
		resolve();
	});
}); 

On the example listed above, our Before Collection Entry Initialize is returning a Promise. This way the OMNIA User Interface will wait for the promise to be resolved, providing you a way to execute asynchronous method calls.

However this new behaviour also supports synchronous code, as visible on the example below:

entry.time = "16:21:02";
entry.location = "41.324317;-8.620915";
entry.packageCode = "F.1000."; 

If you still don’t have this feature and want to start using it, remember to update your OMNIA platform to version 3.4.94, or above.

Platform Update and Documentation

This new feature is part of our 3.4.94 version of the platform.

πŸ“„Β Documentation