Rule for Date Field (10 Business Days in the Future)

Enrico Mancuso January 13, 2025

Hi Community,

I am trying to set up a validation rule for a datetimeinterval field in ConfiForms. The goal is to ensure that users can only select a start date that is at least 10 business days in the future. However, I’m having trouble making this work as expected.

I’ve attempted to use a validation rule to enforce this, but the system either allows invalid dates or fails the validation entirely, even when the input is correct.

Here’s the situation:

  • I want to restrict the start date of the event to be at least 10 business days from the current date.
  • The formula I’ve tried for this doesn’t seem to account for business days properly or might not be supported in my ConfiForms instance.

My Questions:

  1. Is there a reliable way to create a validation rule for business days in ConfiForms?
  2. If business day calculations are not natively supported, is there a recommended workaround?
  3. What is the best approach to ensure users comply with this requirement?

Thank you in advance for your help! I’m happy to provide more details if needed. 😊

1 answer

1 vote
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2025

Hi @Enrico Mancuso 

You can try to employ the workDaysTo function from ConfiForms https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

and have a validation rule with a condition like this (assuming your datetimeinterval field is called dti)

dti.startDate.workDaysTo([entry._now]):<-10

Alex 

Enrico Mancuso January 13, 2025

Its not working: here my source

<p>
<ac:structured-macro ac:macro-id="292d2d52-695a-4e10-9385-c16f369bbc5f" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">start</ac:parameter>
<ac:parameter ac:name="fieldLabel">Beginn</ac:parameter>
<ac:parameter ac:name="values">30</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">datetime</ac:parameter>
<ac:parameter ac:name="validation">start.workDaysTo([entry._now]):&lt;-10</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="ac2db946-ca67-4e19-a756-10a32a7403a6" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">end</ac:parameter>
<ac:parameter ac:name="fieldLabel">Ende</ac:parameter>
<ac:parameter ac:name="values">30</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">datetime</ac:parameter>
</ac:structured-macro>
</p>

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2025

Ok, so there is no datetimeinterval field... and the validation needs to be implemented with a ConfiForms Field Definition Rule

https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validationrule

Enrico Mancuso January 14, 2025

Jetzt so: 
<p>
<ac:structured-macro ac:macro-id="541919e2-11ff-49fc-ae73-98966cb3122d" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">start</ac:parameter>
<ac:parameter ac:name="fieldLabel">Beginn</ac:parameter>
<ac:parameter ac:name="values">30</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">datetime</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="ac2db946-ca67-4e19-a756-10a32a7403a6" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">end</ac:parameter>
<ac:parameter ac:name="fieldLabel">Ende</ac:parameter>
<ac:parameter ac:name="values">30</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">datetime</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="11e3a8ed-e792-402d-b135-96f89d315e97" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">start.startDate.workDaysTo([entry._now]):&lt;-10</ac:parameter>
<ac:parameter ac:name="fieldName">Hold!</ac:parameter>
<ac:parameter ac:name="values">.</ac:parameter>
<ac:parameter ac:name="action">Validation rule</ac:parameter>
<ac:parameter ac:name="actionFieldName">start</ac:parameter>
</ac:structured-macro>
</p>

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

As the field "start" is not a DateTimeInterval field it does not have a "startDate" property - see https://wiki.vertuna.com/display/CONFIFORMS/Accessing+field+values+and+properties

So the condition should be something like

start.workDaysTo([entry._now]):<-10

Also, there is no need to set the value for the "regular expression" parameter

Enrico Mancuso January 14, 2025

thanks it works

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events