Default value

The Default value allows you to pre-fill a part when a new object is created. The behaviour depends on the selected Default value type, which determines how the content is interpreted.

Type

Description

(none)

No default value is applied; the part starts empty.

Plain text

The value is inserted exactly as written, without calculation. Part references are supported. Example: #REPLACE-PARTVALUE-Number||#

NCalc

The value is generated using an NCalc expression. Supports mathematical operations, conditions, and part references. Example: #REPLACE-PARTVALUE-Number||#*#REPLACE-PARTVALUE-Cost||#

JavaScript

The value is generated using a JavaScript expression. Supports dynamic logic, formatting, dates, and part references. Example:

return #REPLACE-PARTVALUE-Type||# === "TypeA" ? "Value" : "";

Showing a date field in readable format

Type: JavaScript

When displaying a date field, it will appear as it is stored in the database, in the format yyyyMMdd:hh:mm:ss. This is not very readable, so use the following JavaScript to define the display:

return CommonInterface.utcDateToString(CommonInterface.stringToDate(#REPLACE-PARTVALUE-Date1||#, "yyyyMMddHHmmss"), 'dd/MM/yyyy');

Data field: set current date as default value

Type: JavaScript

You can automatically populate a Date part with the current date when a new object is created. This is done using a JavaScript default value expression.

return CommonInterface.utcDateToString(new Date(), 'yyyyMMdd');

Note: Make sure the field type is set to Date.

Last updated

Was this helpful?