I am trying to copy the value of an Elements Connect field to a standard Jira custom field of the type "number". I am using Jira on Server and the app "Automation for Jira".
When using an automation rule, I don't get any results from advanced field editing (More options > Additional fields) with the following code (as suggested here):
Here's what i noticed:
The Elements Connect field (of the type "Snapshot" btw) gives me a number in the format "1.069.754,49". Via Rest API I get the following information:
While the info on the Jira custom number field is:
The format of this number field is "862,000" or "862.000", depending which language is used (English or German). The format of the Elements Connect field is always as mentioned above.
I understand that the main problem is that the Elements Connect field has a string value while the custom field expects a numeric value. I have tried to play around with different smart values (.asNumber, .remove("."), .format("###")) but haven't had any luck so far.
Does anyone have a solution for this? Any feedback and suggestion is appreciated :)
Hello @Joelle Güfel
I'm part of the Elements Support team.
That's an interesting question. I have just checked on my end and I don't have any problem to populate a custom Jira number field from a Connect Snapshot field that contains a valid number, as shown below:
This is what I wrote in the Additional fields section:
Can you please remove the asJsonStringArray function you wrote after issue.customfield_11400 and see if it make a difference?
If further help is needed, I invite you to raise a ticket on our Support platform.
After further analysis with @Joelle Güfel, the problem was due to the format of the number used in the Snapshot field which was not understandable for a classic Jira number field.
For a Connect field value to be passed to a Jira number field, the following format must be respected:
So, there should be no thousands separator, and the decimal separator should be a dot.
For example, in the case of a Snapshot field connected to a MSSQL database and using the following query:
SELECT numberColumn as number FROM mytable
Here is how the number should be formatted:
SELECT REPLACE(FORMAT(SUM(numberColumn),'N','en-US'),',','') as number FROM my table
(!) This solution comes from the request created by @Joelle Güfel on our support platform and matches a specific use case. It may not be applicable to other cases.
(i) For your information, we have created the following Change Request: CO-1814 - Elements Connect custom field of type Snapshot Number
For those who are interested, we advise you to vote for it to give it some weight and add you as watcher to be informed of any news.
Hello Community! Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...
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