Set conditions on template level fields based on today's date

Options

Sample Scenario

I am setting up a webform trigger that acts as a project intake form. I want to vary the instructions and additional fields that get displayed based on whether or not the Desired Completion Date is greater than 3 business days from now.
 
 

Sample Issue

Out of the box, Catalytic's webform triggers do not currently support references to dynamic fields such as todays-date.
 
 

Sample Solution

Create a hidden field in the process that contains the date you'd like to make comparisons to, e.g., comparison-date. (To hide a field, set a condition true is equal to false.) Then create a separate process that uses the Pushbot: Update a process template field to set the default value of comparison-date. Configure a scheduled trigger to run this update process at 12:00am each day.
 

In my sample scenario, I configured three actions in sequential order:

  • Write today's date to field date-now;
  • Add 3 business days to date-now and write that value to field date-now-plus-3;
  • Update the default value of comparison-date in the main Pushbot with the recently-calculated value of date-now-plus-3 in the update process.
     

Then, I added conditions to all the other fields in my main Pushbot in one of two ways:

  • fields["desired-completion date"] is less than or equal to fields["comparison-date"]
  • fields["desired-completion date"] is greater than fields["comparison-date"]

Comments

  • Stuart_105238
    Stuart_105238 Posts: 5
    edited November 2019
    Options

    Will the scheduled task adjust for daylight savings time changes? If not, maybe schedule for 1AM?

  • Arthur_319926
    Options

    I tried using the above referenced work-around. It works so long as I keep the "comparison-date" field visible, but as soon as I hide the "comparison-date" field the conditional instructions no longer appear. Does your work-around still function or has a better solution been discovered?