Setting default value for Date field confiforms

Andrzej January 16, 2025

Hello,

I have to assign the date to the end of the current year for the Confiforms Field Definition.

I'm using ConfiForms Rules for Field Definition and 'Set value if empty'.

 

condition: (empty)

Values to set:

EmployeeContractEnd = [entry._now.formatDate("yyyy-12-31")]

 

How the condition should looks like? What's wrong here?

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
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 16, 2025
EmployeeContractEnd=[entry._now.formatDate(yyyy)]-12-31
Andrzej January 16, 2025

thanks again :)

Andrzej January 16, 2025

for some reason the date is still not set. Does my current format has impact on the formula?

Przechwyty12wanie.PNG

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 16, 2025

Well yes.., it should be parseable from the format you have in the field, which is MMM dd, yyyy

Andrzej January 16, 2025

I'm trying to place the date like this, is it correct approach (just to check if it's working, but not)?

EmployeeContractEnd=[entry._now.formatDate(MMM dd, yyyy)]

 And also maybe there is problem with ConfiForms Rules for this field? Or it shouldn't be affected? 

 

condition:

!EmployeeContractEnd:[empty] AND EmployeeContractEnd:<=[entry.EmployeeContractStart]

 

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 16, 2025

Here is how you can set the date 

(I have put "set parameters" values on the page, so you can see what I have)

Screenshot 2025-01-16 at 14.22.38.png

Complete storage format

<ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="f0d53540-a2ea-49d8-8b0f-0a2b151e8069"><ac:parameter ac:name="formName">form</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" ac:macro-id="e70c2cc5-72d6-4b55-bdfc-d30423f6b5c3"><ac:parameter ac:name="type">Embedded</ac:parameter><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="625711c7-44f4-4c05-ba81-af0ad3eeba1e"><ac:parameter ac:name="fieldName">EmployeeContractEnd</ac:parameter><ac:parameter ac:name="fieldLabel">EmployeeContractEnd</ac:parameter><ac:parameter ac:name="type">date</ac:parameter></ac:structured-macro></p><p>EmployeeContractEnd=Jan 31, [entry._now.formatDate(yyyy)]</p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="bfcaf9da-036f-4807-bda1-f18d26d732af"><ac:parameter ac:name="condition">id:[empty]</ac:parameter><ac:parameter ac:name="values">EmployeeContractEnd=Jan 31, [entry._now.formatDate(yyyy)]</ac:parameter><ac:parameter ac:name="action">Set value if empty</ac:parameter></ac:structured-macro></p><p><br /></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="94744241-f65c-4572-914c-2302312b2cd5"><ac:parameter ac:name="fieldName">EmployeeContractEnd2</ac:parameter><ac:parameter ac:name="fieldLabel">EmployeeContractEnd2</ac:parameter><ac:parameter ac:name="type">date</ac:parameter></ac:structured-macro></p><p>EmployeeContractEnd2=[entry._now.formatDate(yyyy).prepend(31-01-).parseDate(dd-MM-yyyy)]</p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="197a3735-dfd8-4751-808e-f7f24a29e629"><ac:parameter ac:name="condition">id:[empty]</ac:parameter><ac:parameter ac:name="values">EmployeeContractEnd2=[entry._now.formatDate(yyyy).prepend(31-01-).parseDate(dd-MM-yyyy)]</ac:parameter><ac:parameter ac:name="action">Set value if empty</ac:parameter></ac:structured-macro></p><p><br /></p></ac:rich-text-body></ac:structured-macro><p><br /></p>
Andrzej January 16, 2025

Thanky you,It helped a lot and I will know for the future!

TAGS
AUG Leaders

Atlassian Community Events