In the Project Admin - Issue Types - Task - Context Fields I have a field type= Checkbox which lists the success criteria of a specific Task, for users to select each criteria as it is achieved.
I need a way to display how many items from this field are selected, ideally in the form of a percentage, and tried to do this by creating a new blank-text field, left empty as default, and an Automation using Smart Values.
Trigger - value changes for "checkbox field"
Action- Edit issue fields > "blank text field"= {{issue.customfield_xxxxx.asPercentage}}
I also tried the Smart Value as {{issue."Checkbox Field[Checkboxes]".asPercentage}}.
Upon changing the items selected in the "Checkbox Field" I check the Automation Audit and it shows it has successfully ran, however the "blank text field" remains blank and does not update at all on the ticket. I also tried refreshing the page (as I find automations don't update field until the page is refreshed).
I find the same results with both Smart Values (field name or cf id), no Audit errors occur ibn the Automation, but also no change is made to the field.
I may be over-complicating the solution, so I'm looking for any assistance in obtaining my desired outcome: a method of displaying %progress of a checkbox-type issue field.
If you know how many values are possible in the checkbox, I believe you can count them as the field should be a list of checked-values. For example:
{{issue.myCheckboxField.size|0}} would be the count of the number of items checked, which you could then divide by the maximum possible count to create a percentage.
Let's assume there are 6 possible values. The expression could be:
{{#=}} {{issue.myCheckboxField.size|0}} / 6 * 100 {{/}}
If you do not know how many values are possible, you would need something more complicated, such as calling the REST API to gather all the options to count them, and then performing the division.
More complicated still...let's say the different values have different impacts on the percentage. You could use conditional logic on the smart values (or list filtering) to add the appropriate impacts.
Kind regards,
Bill
Hi @Bill Sheboy thanks for the quick response.
I've applied this SmartValue into the free text field, on the Action (Edit Issue Field) of my automation:
{{#=}} {{issue."GG SR SC Test".size|0}} / 4 * 100 {{/}}
Where the checkbox field is named "GG SR SC Test" and the total count of items within the Checkbox is 4.
I find this does run successfully in the Automation Audit, however the output in the field is always 0, regardless of how many items are selected in the Checkbox field.
This is progress as before nothing was being entered into this field, and now it always returns 0. So I feel I'm getting closer to getting this working, just wondered if I'm missing something with the SmartValue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy - after some further tinkering, I've now got it to work using:
{{#=}} {{issue.customfield_xxxxx.size}}/ 4 * 100 {{/}}
Thank you so much for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done!
One of the tricky parts about automation rules is figuring out the smart values for our custom fields. Smart values are name, spacing, and case-sensitive...and custom fields with non-alphanumeric characters in their Field Name seem to lead inconsistent smart values.
You can always use the custom field ID, but that can be a bit cryptic in rules. When you want to confirm the smart value for your fields, or if they are even supported, please try this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Basically it describes finding an example issue, calling the REST API from a browser, and then searching for your field's name. That will help you find the right one.
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.