Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Make field manatory only for manual creation

KB February 27, 2024

Hi,

How can I make a field mandatory, but only when users create the issue manually. I want to keep the fields open if there is an automated creation (e.g. through API or jira automation).

 

Thanks a lot!

4 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Andrey Kiyanovsky February 27, 2024

It can be implemented via Jira expression based validators. Such validators are available via apps, such as:

ScriptRunner for Jira

Jira Workflow Toolbox

Jira Misc Workflow Extensions (JMWE)

Workflow Conditions, Validators & Web Assembly Postfunctions

The last one is free, but I didn't test it.

The expression will look like

user.accountId == '<automation_account_id>' || customfield_XXXXX != null

1 vote
Andrew Culver
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2024

Try using a validator that checks for a value in the field during the transition. Create a separate transition without the validator which is only available to the automation users.

0 votes
Leonard Hussey February 27, 2024

One approach we use is for the field to not be mandatory, but have conditions in the workflow first transition based on the user or user group creating the ticket. If condition is not fulfilled, creation fails with a message. One caveat: we use Jira Misc Workflow Extensions (JMWE) add-on for this due to more options vs. Jira's oob conditions...

Leonard Hussey February 27, 2024

This is an example (using JMWE) where we make some fields as mandatory during creation time if the ticket creator is _not_ a JSM portal user:


The following fields must not be empty: Product, Organizations, Severity
The following message will be displayed if validation fails: The following fields are Mandatory: "Product", "Organizations", "Severity"

Validate only issues that satisfy the following Jira expression:

user.getProjectRoles(issue.project).some(pr => pr.name != "Service Desk Customers")

 

0 votes
Jim D February 27, 2024

Hi @KB - You can always just put dummy data in, such as "Created via automation - please update" or even a single character.

I know it's a workaround, but it might be the easiest approach.

TAGS
AUG Leaders

Atlassian Community Events