Default/Prefill field on new entity creation with formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limitless
    Member
    • Nov 2019
    • 33

    Default/Prefill field on new entity creation with formula

    Hi,

    I created a new event entity and i wish to use the following formula to prefill the name field and the date fields : name = datetime\closest(datetime\now(), 'dayOfWeek', 6) - this would return the closest weekend date - which is the default value i want to have --> using formula/workflow doesn't work as its only run it after the record was created or updated..
    Is there a way to prefill these values easily ?
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    please try the formula below:
    Code:
    ifThen(
        entity\isNew(),
        name = datetime\closest(datetime\today(), 'dayOfWeek', 6)
    )
    This formula will work upon creating new record only.
    I suggest you go to Administration -> Entity Manager -> your-entity -> fields -> name -> uncheck the 'required' parameter. It will allow you to leave the name field empty while saving a record.

    Comment

    • limitless
      Member
      • Nov 2019
      • 33

      #3
      Thank you very much Maximus ! Ill give it a try!

      Comment

      Working...