Forums

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

How do i filter value from custom field object in JQL filter (Custom Field Suite)?

RAFAEL LEITE ANTONIO
April 11, 2023

Hello. I'm using the Custom Field Suite addon to create a custom field of the type "Jira Expressions field" and I would like to use the value of this field in a JQL query.

I'm trying to created a field that identifies the worklog entries generated after the start of the current sprint and now I would like to use this field in a Gadget on my dashboard to add the hours used, but I cannot access the value.

Currently the filter looks like this:

issue.worklogs?
.filter(c => c.created > issue.sprint.startDate)?
.reduce((result, worklogItem) =>
(result+worklogItem.timeSpent),0)

I also tried to create this way. The field was generated correctly but I can't read the data either:

issue.worklogs?
.filter(c => c.created > issue.sprint.startDate)?
.reduce((result, worklogItem) =>
result.set("Total",Number((result["Total"] || 0) + worklogItem.timeSpent))
,new Map())


On the screen it appears correctly:

Captura de tela 2023-04-11 113823.png

And analyzing the JIRA return in the API I see this:

Captura de tela 2023-04-11 114107.png

References:

Jira Expressions Types

Jira Expressions 

Please can you help me to solve this problem?

Thank you very much!

2 answers

1 vote
Nic Brough -Adaptavist-
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 Champions.
May 30, 2018

The base url in Jira is used internally by the application for internal linking, putting on emails, connecting to remote and local systems and so-on.

Jira runs on Tomcat, which can relocate systems it runs on different "contexts" if you need to run more than one, or want them to run as part of another site.

Imagine a really simple Jira running on a machine called just "tcs".  Without any context, it will run on http://tcs/  If you want to run it on http://tcs/jira, you need to change the base url, but also tell Tomcat it should be running under http://tcs/jira - to do that, change the context in the server.xml to match where you want to run it. 

In your case http://jira-uat.dx.local is a full path without a context, so your Tomcat server needs to be set with just context = ""

You have not really mentioned the port (8080) either.  How are you getting rid of that?  Running Tomcat on port 80?  Or with a proxy?

Ajay Madar
May 30, 2018

Hi Nic, i hadn't considered the impact of the port; in our example above could we keep port = 8080 and therefor use a base url of http://jira-uat.dx.local:8080? We don't use a proxy as all our JIRA users are internal within our domain.

With reference to the server.xml file, would this mean that we still leave context =""? Would any other changes be required to this file?

Ajay

Nic Brough -Adaptavist-
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 Champions.
May 30, 2018

Absolutely, just leaving the port in place is a really simple approach, and there's nothing wrong with it.  Getting rid of the port is something humans like doing, but in reality, running on port 80 just means "Browser: please assume no port = 80 for http".

Yes, for http://jira-uat.dx.local:8080 you need context = "", and you don't need to change anything else in the file.

0 votes
Jonathan Davies
Contributor
June 1, 2018

Thanks for your support Nic. In addition to the above we had to ask our IT infrastructure team to add the DNS CNAME records for the new URLs and now it works fine.

Suggest an answer

Log in or Sign up to answer