Hello,
I am using a custom field called "team" mapped to "customfield_10013". The below query return the field per ticket as expected.
/rest/api/2/search?jql=assignee = admin&expand=customfield_10013
However when using the provided by script runner addon " issueFunction in workLogged" the custom field is not returned any longer.
/rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')&fields=worklog&expand=customfield_10013
Is this a bug or an expected behavior? How can I get both the worklog and the custom fields?
Thanks,
- Nestor
1. Locate a ticket for which you have logged time in two different dates. Let us assume 30m(1800sec) in 2014/03/10 and 30m(1800sec) in 2014/03/11. The total so far is 1hr(3600sec).
2. The below query should return in a field (timeSpent?) *just* 30m however it just return one field (timespent) releated to worklog (the total = 3600). Note the difference between timeSpent and timespent.
/rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')
I think a better terminology could be to use timeSpent as the time related to the constraints given in the query (30m) while totalTimeSpent should relate to the total amount of time spent in the ticket (1h). I also believe that timeSpentInSeconds (1800) and totalTimeSpentInSeconds (3600) are more useful from an API perspective.
Thank you!
- Nestor
Hi Jamie, I have updated my report above. There is indeed a problem as you can see. Should this be considered a bug?
Thanks!
- Nestor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue is related to the inclusion of "fields=worklog". When used, the custom fields do not show up. You are right custom fields show up even without using expand (which is mandatory in queries not using the plugin functions) and in reality that would be enough for me if I would actually get the time spent at the day of the query. However the "timespent" field returns the total worklog as you can se below:
Request: /rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11') Response: ... timespent: 3600 ... customfield_10013: { self: "/rest/api/2/customFieldOption/10082", value: "Front-End", id: "10082" },
The second call has no effect indeed as per the previous conclusion about expand not needed.
Request: /rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')&expand=customfield_10013 Response: ... timespent: 3600, ... { self: "/rest/api/2/customFieldOption/10082", value: "Front-End", id: "10082" },
The third call will remove the custom field however the timeSpent does reflect exactly the worklog for the date in the query. Now "timespent" becomes "timeSpentSeconds". Unfortunately the custom field does not show up.
Request: /rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')&fields=worklog Response: ... timeSpent: "30m", timeSpentSeconds: 3600, ... customfield_10013 does not show up
The fourth call demonstrates once again that adding the expand field has no effect.
Request: /rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')&fields=worklog&expand=customfield_10013 Response: timeSpent: "30m", timeSpentSeconds: 3600, ... customfield_10013 does not show up
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you summarise the problem, ie give me one url that is not working as expected, and also demonstrate that it works properly with some other function, eg assignee = currentUser()?
Because I don't see where this would be a problem in my code...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Locate a ticket for which you have logged time in two different dates. Let us assume 30m(1800sec) in 2014/03/10 and 30m(1800sec) in 2014/03/11. The total so far is 1hr(3600sec).
2. The below query should return in a field (timeSpent?) *just* 30m however it just returns one field (timespent) related to worklog (the total of 3600). Note the difference between timeSpent (uses h,m instead of plain seconds) and timespent (number of seconds).
/rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')
I think a better terminology could be to use timeSpent as the time related to the constraints given in the query (30m) while totalTimeSpent should relate to the total amount of time spent in the ticket (1h). I also believe that timeSpentInSeconds (1800) and totalTimeSpentInSeconds (3600) are more useful from an API perspective.
Thank you!
- Nestor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have a script field called timespent or timeSpent or similar?
The jql function has not control over what fields are returned. I'm struggling to think this could be an issue with the workLogged function, but I could believe there is a problem with your scripted fields...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
I can confirm we are not using custom scripts.
Are you saying that workLogged function is not responsive for the addition of the fields tineSpent, timespent, timeSpentSeconds? Those fields appear thanks to the use of the function.
Did you follow my two steps? Don't you see in your system that calling the below does not obtain the time spent on a ticket in a particular date range specified in the JQL, but instead it contains the total time spent on the issue:
/rest/api/2/search?jql=issueFunction in workLogged('by admin on 2014/03/11')
Thank you very much for folloing up on this,
- Nestor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie should I open then a bug for tracking puproses?
Thanks!
- Nestor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could do, but you need to give the steps so I can reproduce on a clean database. From everything you've said so far, it doesn't seem like anything to do with my plugin, or if it is looks like there's nothing I can do about it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, hopefully you will be able to replicate in your system. Please let us follow up on https://jamieechlin.atlassian.net/browse/GRV-437. Thanks! - Nestor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked fine for me...the custom field is shown in the output regardless of whether I do expand or not. I'm not sure that's even a valid value for "expand".
The two urls I tested were:
http://localhost:8080/jira/rest/api/2/search?jql=issueFunction%20in%20workLogged(%22by%20admin%22)
http://localhost:8080/jira/rest/api/2/search?jql=key=JRA-1826
with "expand=customfield_12345" I got the same results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worklog works. I have edited the question "the custom field is not returned any longer" when using "issueFunction in workLogged"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does retrieving worklogs work with other queries?
May be escaping issue? Can't think of any reason why it would work with a simple query and not with a function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.