IBM Security SOAR

Expand all | Collapse all

Date Picker (Default Value)

  • 1.  Date Picker (Default Value)

    Posted Sat June 26, 2021 01:49 PM
    Hi All,

    I have a date picker field as a column in a table.  Is there a way to have this field default to "today's" date?  Would like to have it preset for users whenever they add a row.

    Thanks

    ------------------------------
    Paul Formosa
    ------------------------------


  • 2.  RE: Date Picker (Default Value)

    Posted Thu July 01, 2021 04:08 PM

    Paul,

    Not that I'm aware of.

    You could create a rule that triggers whenever a row is added to the data table and calls a script that populates the row column with the current time. 

    Some examples of how to populate date picker / datetime picker fields can be found here, although they're using the python2 packages.




    ------------------------------
    Liam Mahoney
    ------------------------------



  • 3.  RE: Date Picker (Default Value)

    Posted Mon July 05, 2021 01:43 PM
    Thanks Liam.

    ------------------------------
    PAUL FORMOSA
    ------------------------------



  • 4.  RE: Date Picker (Default Value)

    Posted Tue July 06, 2021 10:45 AM
    Hi Paul,

    Just to follow up on Liams good suggestion, here is the rule and Python 3 script that could set the date picker or date time picker AFTER a user has left it blank. Unfortunately there is not a way to auto populate the row in the UI, but there should be an easy option to click 'now' when selecting the value. I've included date picker and date time picker in the script just in case you need both.

    from datetime import datetime
    today = datetime.today()
    
    # If user left date time picker blank
    if row['date_time_picker'] is None:
      row['date_time_picker'] = today
    
    # if user left date picker blank
    if row['date_picker'] is None:
      row['date_picker'] = today.strftime('%Y-%m-%d')​


    ------------------------------
    Sean Mc Cann
    ------------------------------