Need some assistance.
I have two fields - 'Completed' (Yes/No) and 'Date Completed' (Date and Time).
I need to add a rule if the 'Completed' field is marked Yes that the 'Date Completed' field would be required to be entered by the user. The date would not be able to be less than today. Below is what I wrote and the form is not returning any error if I mark the 'Completed' field and do not enter a date or enter a date in the past.
When:
Then:
Invalidate and produce the Validation Message
After the rule is written: I do need to have the ability to for a manager or approver to backdate the Date Completed.
Solved! Go to Solution.
Hi there,
This is actually quite a tricky one but I believe I have it working now.
There are a few things to keep in mind.
With that in mind this is the formula I used.
and(equals(Completed,true),or(greaterThanOrEqual({Self},DateTimeNow),isNullOrEmpty({Self})))
Completed is the same variable you use
{Self} is the preferred method to refer to the control the rule is running on, similar to a this()
DateTimeNow is a construct form variable built that combines Date and Time together into a single variable, to make that, follow the steps below.
Formula used: formatDate(Current Date,'ddMMyyyy')+ formatDate(Current Time, 'HHmm;')
Formula used: date(subString(DateTimeNow str,0,2), subString(DateTimeNow str,2,2),subString(DateTimeNow str,4,4),subString(DateTimeNow str,8,2),subString(DateTimeNow str,10,2))
As you can see with the rule used I get validation error when trying to submit.
Kind regards
Jake
Thank you so much, Jake!