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

How to remove comma when getting value from a field with number type Edited

The thing is: I have 2 customfields, first is a number type field, second is URL type field.

 

When a user modifys the number type customfield, I want to copy that value into an another customfield(which is the URL type field).

The URL field has a Prefix, and the end will be the value of the number type customfield that the user just typed into the number type field.


I succesfully solved this problem wih Automation, but when I getting the value of the modified customfield(number typed), it will put comma inside the numbers. Like: 1 -> 1.0

How can I replace those commas?

In My Automation rule, my "additional fields" JSON is: 

{
 "fields": {
  "My URL Customfield": "https://someurl.com&id={{issue.customfield_10071}}"
 }
}

I tried to use smart values - JSON functions but, it won't worked for customfields somehow...

 

Thank you for your help,

Zoltan Erdos

2 answers

1 accepted

1 vote
Answer accepted
Daniel Ebers Community Leader Jan 09, 2021

Hi @Erdős Zoltán

from the looks I solved the riddle - but please do an own test. Happy if you can confirm if it is what you were looking for.

I am just showing the difference to your JSON snippet, do let me know if you need further information:

{
"fields": {
"customfield_10082": "https://www.example.com&id={{customfield_10081.format("###")}}"
}
}

 

grafik.png

 

Cheers,
Daniel

Hi Daniel,

 

Thank you so much, it is working! 


Cheers,

Zoltan

0 votes
Prince Nyeche Community Leader Jan 08, 2021

Hi @Erdős Zoltán 

The number field is translating to float value. I don't think you can convert that easily. so it's better you simply use text custom field rather than number field type. If you still want to use the number field, then you should look at the functions for maths expression, like rounds().

Thanks, I think maths expressions are not solve my problem here. (eliminate comma)

Okay, I can change it to Text Field, but I wanted that the user only can type numbers to this field, and with text field how it is possible? 

I need to implement some triggers to the workflows?

I know script runner can do such which is an additional addon and cost. however ensuring the text field is of type numbers with validators with Jira's native feature I don't think that exist except what you can do is create a third field of text field type, copy the value from the number field type into the text field and use the text field in the url field.

Like Erdős Zoltán likes this

Hmm, I will try your alternative solution. Thanks.

Unfortunately, it won't work, but it is logical.

I copied from number field into a text field, but the moment that I copied into a text field, it copied with comma into it, just like when i copied into URL field from number field.

 

image.png

Prince Nyeche Community Leader Jan 08, 2021

Probably better to simply just use a text field. I checked on the Workflow feature for validators there's an option you can actually use as a validator with "Regular expression check" that should help validate for number input on the workflow for the custom field.

Like Erdős Zoltán likes this

Yeah, that could work if I put it to every transition. But what will happen when the status of the issue doesn't change, just somebody modify that customfield? The validator will triggered when there is a transition, right?

Yes, the validator will only trigger when there is a transition. The best scenario here is to use an advance script such as script runner but again that's just additional cost. which i won't recommend for this type of use case.

Like Erdős Zoltán likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

132 views 3 7
Read article

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