Using Automation, I'm trying to do a very simple (seemingly) calculation but not having much success. Actually - I did get it to work, but still getting the answers to the questions below will greatly increase my understanding of this functionality
Here is what I'm trying to accomplish.
Here were my attempts
Bonus question
Hey @Chris Grace,
So, your first question, the way to avoid this is to use the default operator, then you don't need an IF. You do it like this:
{{hours|0}}
So that will default to 0 if it has no value :)
So, your second question. IF blocks and related blocks, everything that happens on these is scoped to this block and isn't available on the main line execution, that's why you saw some of these issues.
So, your bonus question. Not easily, but I think it is possible with Entity properties. The issue entity properties are accessible by smart values and we have an action to set them. This action can also set project entity properties. If you can access these via the issue.project.etc then you could have a rule to set the rate on a project and then access it to via the smart values. You'd need to do a bit of experimentation here to see if you can get it working.
Cheers,
Simeon.
Hi @Chris Grace ,
maybe alternative suggestion for you bonus question. I would create number custom field for the rate. You can set default value for each project using contexts in this custom field configuration. Then each new issue will be created with the rate specific for the project. You would be able to see, which rate was used in your calculation. If some rate changes during time, you can update the default value, old issues won't be affected (I believe you don't want to change the history).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much Simeon and Hana.
Simeon - I will test your suggestions. Would you please provide a link to the documentation where I can reference your answers. I really did look and could not find this information.
Hana - thank you. That's a good idea too. I need to see if they want to keep the rate value constant in the history or if they are OK with using the "current" rate.
Thank you both again very much!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chris Grace ,
I don't think that we have documented the question that you had around the scope of variables. I'll look into getting this resolved.
Default values for smart values are in this section. https://support.atlassian.com/jira-software-cloud/docs/what-are-smart-values/#Whataresmartvalues?-Defaultvalues
The entity property details got lost in the docs move too I believe. Our action has a link to the Atlassian docs on them. To view them on an issue, you need to use the REST api.
Eg, XXXXX.atlassian.net/rest/api/2/issue/SP-41/properties
The interesting thing about these is how you access them. This is an example of what you'd see from the above URL:
{
keys: [
{
self: "XXX.atlassian.net/rest/api/2/issue/38007/properties/a-property",
key: "a-property"
}
]
}
To access this in smart values you would do the following:
{{issue.properties."a-property"}}
This is especially important if the property contains periods as they would break our smart values if not in quotes.
I'll let get our docs team know about the omissions and get them onto it!
Cheers,
Simeon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.