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!
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.
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.
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...
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
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, SeverityThe 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")
It looks like you're new here. Sign in or register to get started.