Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to force a value in a field only when solving the issue

Prueba Cliente Edu January 21, 2021

JIRA Service Desk 4.13.2 (Server)

I need a custom field to be mandatory only when solving or canceling the ticket.

If I define the custom field as mandatory, it is invalid, because I only need to fill it in when resolving or canceling the issue.

I have checked the "workflow validations" but can't find any valid ones.

Workflow validations.JPGScriptrunner.JPG

Someone could help me?

Thank

3 answers

1 accepted

1 vote
Answer accepted
Dirk Ronsmans
Community Champion
January 21, 2021

Hi @Prueba Cliente Edu 

 

To make the field mandatory in the in the transition you will need to add a validator. Then like @brbojorque   says you would add a transition screen so you are sure they can actually enter the value.

https://confluence.atlassian.com/adminjiraserver/using-validators-with-custom-fields-938847524.html

Prueba Cliente Edu January 21, 2021

As you have mentioned, I think it is necessary to install the Utilities Suite (JSU Automation Suite for Jira Workflows - Server Version) to change a field to mandatory during the workflow. But that Suite of Utilities is not free.

Is it possible to use a "Custom script validator" or "Simple scripted validator" to make a custom field mandatory during the workflow?

Thank you

0 votes
Prueba Cliente Edu January 21, 2021

I have seen this:

https://confluence.atlassian.com/jirakb/make-custom-fields-required-in-a-workflow-transition-in-jira-server-691011903.html 

 

I have already created the transition screen, but when I go to create the validation to change the field to mandatory, no valid option appears.

Workflow validations.JPG

0 votes
brbojorque
Community Champion
January 21, 2021

Hi @Prueba Cliente Edu ,

You should check out how to add a Transition Screens and requiring one or more fields in the transition solving or canceling a ticket (assuming it is an actual status).

https://confluence.atlassian.com/jirakb/add-a-custom-field-to-transition-screen-718834736.html

Prueba Cliente Edu January 21, 2021

As you have mentioned, I think it is necessary to install the Utilities Suite (JSU Automation Suite for Jira Workflows - Server Version) to change a field to mandatory during the workflow. But that Suite of Utilities is not free.

Is it possible to use a "Custom script validator" or "Simple scripted validator" to make a custom field mandatory during the workflow?

Thank

brbojorque
Community Champion
January 21, 2021

Hi @Prueba Cliente Edu ,

Definitely, it will work in ScriptRunner Simple scripted validator however it may need a bit of coding to make it work in a Transition Screen (You have to detect the name of the Transition Screen and do the validation)

Here's the condition, make sure to update it with the name of your custom field.

cfValues['My Single Select']?.value == NULL

For reference:

https://scriptrunner.adaptavist.com/5.3.7/jira/recipes/workflow/validators/simple-scripted-validators.html

Prueba Cliente Edu January 22, 2021

Thank you very much for your answer.

I'm doing it, but it returns the following error:

Error ScriptRunner.jpg

How can I solve it? Thank

Suggest an answer

Log in or Sign up to answer