Forums

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

Unable to fetch results based upon the values stored in a custom field

Farrukh Elahi January 24, 2024

I have got a custom field called 'Risk Score' which is getting populated automatically based on Impact x Probability. It's a number field which has got values such as: 1, 2, 3, 4, 6, 9 etc. 

 

When I'm trying to fetch data in JQL, it is not returning anything.

 ScriptRunner.PNGJira-admin.PNGRisk-JQL.pngJQL.PNG 

3 answers

0 votes
Joseph Chung Yin
Community Champion
January 24, 2024

@Farrukh Elahi -

Just like other community leaders suggested, can you provide more details on your scripted field setup via ScriptRunner?  

It is very important that you use the right template format (example we have a field xyz, the scripted field format is selected using duration - see image below).  You can click on the "..." symbol on the right of the your custom field to obtain the field configuration in ScriptRunner.

2024-01-24_20-00-48.png

Another thing you need to check to ensure this custom field is applied to your project and project issues properly by accessing it via JIRA Administration >> Issues >> Custom fields.

Please provide your updates, so we may be further assist.

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

Farrukh Elahi January 24, 2024

Hi Jospeh, The field is applied to all projects, and it's a floating point number template in Script Runner:

 

Risk-projects.PNG

Risk-Score.PNG

Joseph Chung Yin
Community Champion
January 26, 2024

@Farrukh Elahi -

What is the details on your script implemented for this custom field?  Please advise.

Best, Joseph

Farrukh Elahi January 29, 2024

Hi @Joseph Chung Yin 

Here is the script: 

Script-code.PNG

0 votes
JiraJared
Community Champion
January 24, 2024

Silly question and to eliminate any obvious conflicts, but is there multiple custom fields with the same name "Risk Score"?

Are you able to use `cf[12345] = 9` in your JQL - where 12345 is the customfield_id of the "Risk Score" field?

Farrukh Elahi January 24, 2024

Hi JiraJared, No, there is only one field with Risk Score name, and I'm not getting any results either while using cf[13008].

0 votes
Trudy Claspill
Community Champion
January 24, 2024

Hello @Farrukh Elahi 

Exactly how is the field being populated automatically? Automation Rule? Workflow Post Function?

Can you show us a screen image from the Custom Fields admin screen showing the field type for this field?

Can you show us a screen image showing that an issue type of "Risk" actually has a Risk Score of 9?

Farrukh Elahi January 24, 2024

Thanks Trudy for looking into this question! 

I have included all the screenshots, it's a Script Runner field which is multiplying impact with probability and value is saved in Risk Score. 

Much appreciated your help.

Trudy Claspill
Community Champion
January 24, 2024

I am not currently working with ScriptRunner on a self-hosted instance.

However, reviewing the product documentation I see it mentions that the data is not actually stored "in the issue" at all for scripted fields.

The second paragraph is the one that seems relevant. It says:

" It is possible to search on these values if you set up one of the four shipped searchers."

But I haven't found any details on the steps for setting the four shipped searchers.

I'll ping some other folks to see if somebody with more knowledge on this topic can jump in.

Like Farrukh Elahi likes this

Suggest an answer

Log in or Sign up to answer