I'm thinking a need a number type field that displays as a percentage. Maybe a text field that converts to a number elsewhere may be necessary. I'm not sure what the best route to go would be.
1. User creates an issue and has to enter a value in a field named Confidence.
2. The end-user should not have to enter the percent symbol '%' or a decimal '.', just an integer in the range of 0-100.
3. Once the issue has been created, the value should display as a percent.
4. The value in the Confidence will be used in a score calculation.
Any ideas? Any add-ons? Thoughts?
Here is what you can do, but you need two add-ons for this: Jira Suite Utilities and Script Runner.
First with JSU plugin, you can add a regular expression validator on your create transition to make sure user enter a number between 0-199.
Second, you can create a scripted field with Script Runner plugin and add % to the number entered by the user with a short groovy script. Then show it to the user on the view screen of the project.
Hope this helps.
This is the official documentation for script field:
A custom script like below would do:
def issueManager = ComponentAccessor.getIssueManager()
def authenticationContext = ComponentAccessor.getJiraAuthenticationContext()
def user = authenticationContext.getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObjectByName("number1")
def percentage = "%"+issue.getCustomFieldValue(customfield).toString()
To limit the number between 0-100, you need to use Jira Suite Utilities Regular Expression Validator. You need to add it to your workflow transition as validator:
Hope this helps,
Hi @Rhett - I am not completely certain I got your question right. So, what you are trying to do is to have a custom field that can take a number between 0 and 100. And after issue create form (or issue edit form) is submitted, this number (no calculation intended) just shows a percent (%) symbol suffixed to it ?
If my understanding is correct, we are not really getting into the scenario of calculated or scripted fields in any scope. If the '%' symbol is just for a way to show the users the value of the field showing is a percentage, have you considered adding this to the field name itself ? Something to say - "Confidence (%)" ?
Also, here are a couple of pointers that may help, if you haven't already looked at them -
Sorry, if I completely got your question wrong!
I also have the same question.
But from the above '2' links i got nothing.
Please can you specify some more how to add "%" in my custom field?
Hello @Rhett ,
Have you fixed the same? Did you get that '%' on your field?
Please suggest me too.
I just wanted to quickly jump in and confirm that you will need an app for that. If you were using Jira Workflow Toolbox (JWT) you could accomplish both requirements with a single app though:-) https://marketplace.atlassian.com/apps/29496/jira-workflow-toolbox?hosting=datacenter&tab=overview
Use cases for calculating a field can be found here:
The display format can be set independently:
Regarding the validation of the input field you could use a boolean validator to ensure the number range is being enforced:
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events