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.
Example:
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?
Hello,
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.
Regards,
Elifcan
This is the preferred method and we have ScriptRunner. However, I'm extremely new to using it. I couldn't find anything on their site about how to do this. Any other resources out there that might help in learning?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is the official documentation for script field:
https://scriptrunner.adaptavist.com/5.0.4/jira/scripted-fields.html
A custom script like below would do:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.event.type.EventDispatchOption
def issueManager = ComponentAccessor.getIssueManager()
def authenticationContext = ComponentAccessor.getJiraAuthenticationContext()
def user = authenticationContext.getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfield = customFieldManager.getCustomFieldObjectByName("number1")
issue.getCustomFieldValue(customfield);
def percentage = "%"+issue.getCustomFieldValue(customfield).toString()
return percentage
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,
Elifcan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You completely understood and thank you for your reply. I thought about adding the (%) to the field name but hoped someone had a method to change the display itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @[deleted] ,
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.
Thanks!
Regards,
Akbar Pasha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my jira Instance, i just created a dop down list
0%
1%
.
.
.
99%
100%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rhett,
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:
https://apps.decadis.net/display/JWT/Calculated+Number+Field
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:
Cheers,
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.