Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

asNumber smart value

Deleted user April 1, 2021

Appreciate any help the community can give me. 

I'm trying to do something that is seemingly simple. I want to automatically convert a string to a number. I have a custom field with data type of string called "Dev estimate" and I want to edit the Story Point field which is of type number. Unfortunately, it is both successful and not producing any results (namely, converting a string to a numeric).

Here is a screenshot of the automation:

Screen Shot 2021-04-01 at 1.20.51 PM.png

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2021

Hi @[deleted] 

Some ideas to try:

  • If you log your custom field to the audit log does it contain what you expect?
  • Does the case of your smart value "Dev estimate" match the name in the field definition?
  • Have you tried to use the custom field ID instead?

Best regards,

Bill

Deleted user April 5, 2021

Hi @Bill Sheboy 

Thanks for your quick response. See below...

  • If you log your custom field to the audit log does it contain what you expect?
    >>Thanks. I added a log and the field data is what I would expect. Unfortunately, the copy and conversion results in any pre-existing value to be (presumably) nulled out.

  • Does the case of your smart value "Dev estimate" match the name in the field definition?
    >>TA: Yes, it does. 

  • Have you tried to use the custom field ID instead?
    >>TA: Yes, tried that with multiple versions of the custom field syntax (customfield_id, cf[id], name). If you know of a different syntax that will assure success, please let me know.

If you have any other ideas, I'll take 'em. 

Thanks again, Bill!

Tim

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2021

Hi Tim,

Thanks for the detailed answers! By the way, I should have sent this link before that has a how-to for confirming which smart values are available, based upon an example story:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

 

Okay, let's try to diagnose this from both directions:

  • Is this for a Company-managed project (formerly known as Classic) or a Team-managed one (formerly Next-Gen)?
    • Company... use the Story Points field
    • Team... use the Story Point Estimate field
  • Please check the project's settings to see if you have one-and-only-one Story Points field within the scope.  If you have multiple fields there could be a collision issue happening.
  • I wonder if there are some none-printing characters impacting the conversion.  Please try this value, {{issue.Dev estimate.trim().asNumber}}
Deleted user April 7, 2021

Thank you again, Bill.

We use Company/Classic and currently using the Story Points field.

We only have one-and-only-one Story Points field within the scope.

I configured my automation rule to use {{issue.Dev estimate.trim().asNumber}} but it didn't change the results so, I added more logging to capture the values before AND after executing the edit. It helped reveal what appears to be a bug. In brief, here is what I tried:

-directly edit the story points field to contain a valid value

-modify the value in the Dev estimate field

-modify the value in the Dev estimate field, again

-check the logs

It's interesting what happens...

For the first Dev estimate field modification, the story point value does not change.

For the second Dev estimate field modification, the story point value is nulled out.

I've attached the results of the log.

Thanks in advance for any insight you can give. 

Tim

 

Screen Shot 2021-04-07 at 7.41.06 AM.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2021

Curious..  Have you checked if any workflow, other rules, or scripting post-functions impact either of those fields?

Have you checked if Story Points was changed from numeric to a defined-value list?  That could explain why 8 (a valid Fibonacci number) would work and why 16 would not.

Deleted user April 8, 2021

Hi Bill,
Yeah, nothing else is getting in the way of the fields. Story Points is still a numeric. 
I had another thread going with Atlassian Support. They suggested this simple change to the smart value,

issue.customfield_10127.value

And, it worked! 

I'll follow up on the odd deletion behavior but at least I can move forward with my project.
Thank you again, Bill, for all of your help. It was truly insightful.

Like # people like this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 8, 2021

I am glad you got it to work! Good job, Atlassian Support team!

Makes me wonder if that custom field was ever created with another type, or is shadowing a previously and similarly named field.  Hmmm...

One could observe that some aspects of automation for Jira are a tad under-documented at this point.  (e.g. when can custom fields use the name versus the number versus the <> syntax, and with which functions).  No doubt that will improve over time and with customer experimentation.  ;^)

Have a good one!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events