Put global var in field in default

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Andrey
    Junior Member
    • Nov 2025
    • 1

    #1

    Put global var in field in default

    Can you tell me , how to set the default value of the global variable {{today}} for a "string field"?

    For example Default: Maintenance Report #{{today}} -

    This will be returned when creating a new order.
    Maintenance Report #16112025 - 12345Volvo12BIBI12UK
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1792

    #2
    You can achieve that by formula:

    PHP Code:
    ifThen(
    entity\isNew(),
    today datetime\today()
    ); 
    The isNew tells, that the value is set only in new records. The formatting will be in the default 2025-11-17, but you can format it in the same formula like so:

    PHP Code:
    ifThen(
    entity\isNew(),
    today datetime\today(datetime\format(today,'Europe/Berlin','DD.MM.YY'))
    ); 

    Europe/Berlin is the timezone, which you may omit. Then the timezone of your installation is taken. DD.MM.YY displays 17.11.2025. The date formatting follows php date formatting.

    To get the date value into your order, create another formula string\concatenate, whre the today field will be one string part.
    Last edited by shalmaxb; 11-17-2025, 08:52 AM.

    Comment

    Working...