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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Display number in 1000 Multiples Edited

Hello

I create a script field in my Jira, and I want  number intered in this field displays in 1000 multiples.

for example:

When user in Create Screen entered number(456243) in "Number" field, Instantly value shows (456,243)  in this field(before create issue).

 

I  wrote a script in "script field" ,but it return  error.

Please Help me to write correct script.

Import com.atlassian.jira.component.ComponentAccessor

Define Number=ComponentAccesor.getCustomFieldManager().getCustomFieldObjectByName("Number");

Return issue.getCustomFieldValue(Number)/1000

 

Thanks

1 answer

0 votes
Leo Community Leader Nov 25, 2019

Hi @RainBow,

I would suggest you to go with Number field(custom field instead of script) and write a behaviour for the same(which will set/display value before clicks create button once focus changed to next field) 

below behaviour snippet may give you some reference

def cf = getFieldByName("Field Name")  // getting field
def cValue = cf.getFormValue() as Double //getting it's value from the form/screen
cValue = cValue/1000 // performing action
cf.setFormValue(cValue) // setting it's value in the current form/screen

BR,

Leo

Hi @Leo 

I use your solution, but my problem don't resolve. :(

I define behaviour for this field and write your script but number in this field shows like before.

Example:

I enter 1234567

And show 1234567

While I want shows 1,234,567

Thanks

Leo Community Leader Nov 25, 2019

I misunderstood your query, I'm not good at formatting things. :(

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Events near you