Skip to main content
Nintex Community Menu Bar

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:

  • If(Completed, TRUE, ""), Date Completed="",>=gToday]

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.

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.



 





  1. Rules do not require an if statement unless it is nested, when you are comparing multiple values you should use and/or


  2. You will need to make sure the date value is also filled so it will require a isNullOrEmpty() check



  3. You will need a date and time to compare to, sadly there is no quick and easy way to get this so you have to build form variables to allow this.




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.



 





  1. Open the forms variables panel


     





  2. Add a new variable and call it DateTimeNow str and configure as follows:


    Formula used: formatDate(Current Date,'ddMMyyyy')+ formatDate(Current Time, 'HHmm;')





  3. Add another variable called DateTimeNow and configure as follows:


    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! 


Reply