Hello Atlassian Community.
What i am looking to do is to calculate a risk score based on the values of several fields that a customer would answer when creating a ticket. I was looking up ways to do this and found some documentation on using a lookup table for this, but the issue i ran into is that several of my questions have the same answer (yes/no) but should have different values towards the total score.
I think i could create a lookup table for each custom field but i was wondering if instead i could somehow specify the custom field in the key. So basically i get something like the below.
| Key | Value |
| CustomField_1 = Yes | 10 |
| CustomField_1 = No | 5 |
| CustomField_2 = Yes | 20 |
| CustomField_2 = No | 10 |
Hello @Jeremy Wood
Yes, you can make the keys like that.
You would then have to build up a string that gets the field "name" and the field value and concatenates them together to give you a single value you could use as the key during your get() operation on that table.
{{tableName.get(yourConcatenatedString)}}
That's great to hear i can do this. But I'm not sure i follow your explanation. Would you maybe be able to show me how i would set this up with some screenshots?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So let's say one custom field has the name "My Field", and you set it to Yes.
And you want the Score for that to be 100, while the score for the value being No will be 10.
You create a lookup table with the name "My Table" and you say you want something like this:
| key | value |
| My Field = Yes | 100 |
| My Field = No | 10 |
To get the value 100 from that lookup table you need to use the get() operation for the table and provide it with input that matches the key. The format of the command is:
{{tableName.get(key)}}
i.e.
{{My Table.get("My Field = Yes")}}
...will return the value of "100".
To get the value "100" you will need to construct a string that matches what you specified as the key for that value.
To get the actual value in "My Field" in your issue you would use the smart value:
{{issue.My Field}}
That gives you "Yes". That doesn't match your keys.
You need the name of the field also. You can get that from the smart value:
{{issue.My Field.name}}
ref: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--issue.
You can use the concat() function to stick two strings together; i.e.
{{issue.My Field.name.concat(issue.My Field)}}
... will glue the field name and the field value together yielding
"My FieldYes"
That still doesn't match your keys.
....
Given all this work to construct values to match your keys to do you lookup, the simpler path is to create separate tables for each field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the details answer!
I agree its not simpler, but now im curious about the concat function. Can you do multiple concat(String str) in a single value?
For example:
{issue.My Field.name.concat(" = ").concat(issue.My Field)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should give that a try and see what you get. ;-)
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.