Developing python script to fetch JIRA logs to generate the timesheet
1. Wanted to fetch the custom field Start date cf[10015] but it is giving null
Hi @Marc
Welcome to the Community!
I am unsure if I understood your problem.
Are you sure the customfield's value is not null, check adding this to the JQL
AND cf[10015] is not EMPTY
If this customfield is date only custom field can you make sure that you are using YYYY-MM-DD format?
Hi,
I am attachnig the screeshot to clarify
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this "Start date" that we see on the screenshot the cf[10015]? If yes, these rows indicate that they are July 01, so we don't expect them to be between 2025-08-01 and 2025-08-31. My second question, are you sure that it's a Date field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tuncay,
Sorry, my mistake refer the recent screenshot
2nd Question - Start date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, I see that using the start date in the JQL returns results as expected. So, do you mean that JQL runs OK in the issue navigator but it doesn't work via the Python script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you are right it is not working in python script now let me know is it feasible to use start date to generate the timesheet. Because created and updated wont give the exact date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, of course it's OK to use any field/custom field in your query.
Could you log the JQL which is generated by the script? Seeing the final generated JQL (before executing) will help us have a better idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry i cannot share the log due to confidential but i was using the below code and i gues created and updated is blocking
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think sharing the final JQL from the code breaches confidentiality. I just need to see the JQL that is run via the code (to verify that the date values are assigned in the correct ISO format and also to check quotes and parentheses).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
assignee =
AND (
(created >= "2025-08-01" AND created <= "2025-08-31") OR
(updated >= "2025-08-01" AND updated <= "2025-08-31") OR
cf[10015] >= "2025-08-01" AND cf[10015] <= "2025-08-31"
)
ORDER BY created ASC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suppose you intentionally removed the assignee's right part. If not, that's a problem.
Considering the fact that this JQL is generated by the code, this MUST work. Removing created and updated fields and leaving only the cf[10015] equation should work. Since that's the date field and the date part is generated correctly (yyyy-MM-dd), I cannot see any problem.
assignee = <accountId>
AND (
cf[10015] >= "2025-08-01" AND cf[10015] <= "2025-08-31"
)
Make sure that it runs OK in the issue navigator.
If that works in the navigator and not from the script, then please share what error or problem you are getting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Yes i intentionally removed Assignee ID. Ok i understand the code and will make the changes accordingly.
Please do reply on my 2nd Question. What if the team member by mistakely add Date Started in Time tracking as "2nd August" as shown in worklog and Start date is 5th Aug but it still shows the task start date as 2nd August in python script? How to avoid this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see! That really depends on how you’d like to handle it.
You could filter issues by Start date and exclude any work logs that fall outside the range (you’d need to add an if
statement in your script for this), or you could filter issues by worklogDate directly in your JQL.
Keep in mind that an issue can have multiple work logs, and some may fall outside the target range (e.g., 1st to 31st August). For that reason, I believe it’s better to filter out the work logs in your Python script.
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.