How to make a field as mandatory

Jyothi Ravipati October 14, 2021

Hi,

 

I was strucked up in making a Field as mandatory while moving from one transition to another.

Basically, I know it how to do by using a Validator 'Field Required'. But my concern is I already have an automation to update the field with some text while creating. 

But I need to make the users to fill that information in field, then only they can be able to move the transition from one to other.

Please anyone suggest me with the solution.

Thanks in Advance

7 answers

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

Thanks, David!

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

Hi @Jyothi Ravipati 

the problem is: how do you know if the user really answered the questions if they are just freeform text in the field? You could check that the length of the text in the field is greater than a certain number of characters (the initial length of the value that's pre-filled, plus a minimum expected number of characters the user must type) but that's no guarantee.

To check the length of the text, you can use a Build-your-own Validator with this code:

!!issue.customfield_12345 && issue.customfield_12345.length > 500

where issue.customfield_12345 needs to be replaced with the custom field ID, and 500 with the expected minimum length.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

You would create a custom validator for that transition, but I am not a nunjucks expert and not sure of the syntax. 

@David Fischer could you help? 

0 votes
Jyothi Ravipati October 14, 2021

Hi John,

We do have An add-on JMWE, But may i know how to work with that to get the required solution?

 

As this needs to be done for a single transition in a workflow.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

Oh, that's a little more complicated then. One way to to use a third party add-on like JMWE or ScriptRunner to check the value/size of the field to see if it is larger character wise. 

An out of the box solution might be to create another custom text field and populate it with the values of the Root Cause field when it gets updated. So an automation rule that triggers on Root Cause value changed, then do an action to Transition issue to "To Do". You would have a validator on the transition to "To Do" to make sure the new custom field is populated.

Or if you want the Root Cause to be the final field, start with the new custom field having the questions and needing to be updated, and then copy the value to the Root Cause field. 

0 votes
Jyothi Ravipati October 14, 2021

Hi John,

Thanks for your quick response.

I will explain you clearly.

I have a field named 'Root Cause' with auto filled text(Having Questions) while creation of issue.

So when I make a transition change from one status to other, I need to make sure that whether the text with questions are answered or not. 

What is the procedure for doing so?

If I have added a field required validator, it is not working because the field is not empty, and already having some text there.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

Hi @Jyothi Ravipati 

I am a little confused by your question. 

Why can't you just add the validator to make the field required? It shouldn't have anything to do with your automation rule that fires on create, unless your validator is on the Create transition. 

Suggest an answer

Log in or Sign up to answer