Can we set confiform rules for field definition while on modified and not on created

Dhiraj Kr_ Gupta
Contributor
December 7, 2024

I have a confiform which have field 1 and field 2.

When a user submits a new entry then these fields are not mandatory. 

But when a user click on edit of these submitted records then both field 1 and field 2 are required during modification.

Can it be possible 

1 answer

1 accepted

3 votes
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.
December 7, 2024

The easiest way is to check for id

id:[empty] - for new records -> create

!id:[empty] - for existing -> edit

 

Alex

Dhiraj Kr_ Gupta
Contributor
December 7, 2024

OMG, this was tricky.

Thanks Alex💫💫

Dhiraj Kr_ Gupta
Contributor
December 7, 2024

But this is not working 

Field name( or regular expression): id

Condition: !id:[empty] AND Name:[empty]

Action to execute: Validation Rule

Message: Name Required 

 

 

Ali Mola
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 7, 2024

To do this, you can use the "on modify" condition in your validation rules to enforce that Field 1 and Field 2 are required when a record is being edited. For example, you can use a script or rule like:
if (entry.status == 'modified') { if (!field1 || !field2) { return "Field 1 and Field 2 are required when modifying."; } }
This ensures that when a user edits an existing record, both Field 1 and Field 2 are required. However, when creating a new record, these fields remain optional. Also, you could create a specific form or section related to fresh herbs or another product category, where you define the fields conditionally based on the context.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events