Forums

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

Worklog automation rule returning only first 20 entries

Julio Ribeiro April 9, 2022

Hi there,

I've set up an automation rule to invoke a webhook triggered by any update in the worklog. It works fine, but after 20 entries I got always the same 20 entries. I've seen some posts related to limitation of 20 entries when using REST API to fetch worklogs from Jira, but I'm not sure if the problem (date back 2014 in some posts...) is the same, because in my case I'm not fetching Jira, but being invoked (webhooked) . Can someone give some directions?

 

Tks

2 answers

0 votes
Bill Sheboy
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 Leaders.
April 10, 2022

Hi @Julio Ribeiro -- Welcome to the Atlassian Community!

Are you asking about this REST API method: https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/issue-getIssueWorklog

If so, this method uses pagination, like many of the REST API ones.  You would need to use startAt to grab the results, page by page.

And also, what problem are you trying to solve by doing this?  Knowing that may help the community to offer you suggestions.  Thanks!

Kind regard,
Bill

0 votes
Mohamed Adel
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 Leaders.
April 10, 2022

Hi @Julio Ribeiro  and welcome to the community

can you elaborate more about the webhook you are using, i'm a bit confused about the 20 entries while you are not fetching worklog

 

Regards

Adel

Julio Ribeiro April 23, 2022

Hi @Mohamed Adel , thank you

 

The webhook I'm using was set in a project rule (automation) as a Global rule.

Screenshot 2022-04-23 at 11.22.58.pngThe automation rule is triggered whenever a worklog change, and that is working perfectly. As a response to this event, a webhook call is made and a POST request with the entire issue data (in Jira format) is sent to a remote webserver.

However, I've noticed that when the issue has more than 20 worklog entries , for example,  24 entries that I can confirm via UI (issue activity worklog), the object in the Jira data payload received (issue.fields.worklog.worklogs) contains only the first 20 entries. The other 4 entries isn't listed.

Screenshot 2022-04-23 at 11.48.38.png

Way to reproduce:

1. create a global (or project) rule automation that is fired when a issue change the fields value of worklog, and set the action to be send a webhook to an endpoint you can check later the data you receive. (you can mockup on requestbin.com)

2. Create an issue and insert 20 entries in its worklog and check the visually (via UI, open issue and see in "activity" , "worklog")

3. Insert a new worklog in the issue to fire the automation rule again or simulate it by clicking and filling the "validate your web request configuration" in the rule action (see first print)

4. Check in the remote webserver the (json) payload data received, and look at the path root/issue/fields/worklog/worklogs, as the second print above. You'll see the total of +20 entries, but can list only 20 of them.

I hope this helps to explain better

 

Thks

Julio Ribeiro

Julio Ribeiro May 21, 2022

Anyone?

Bill Sheboy
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 Leaders.
May 21, 2022

Hi @Julio Ribeiro 

As already noted, the REST API uses pagination to return values, helping to manage performance when there are many results.  When you need all of the values, use the startAt parameter to page through the entries.

To back up a bit: what problem are you trying to solve?

If you only need the last value, based on your trigger of Work Logged, you can use the smart values to get that information: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--worklog--

Thanks,
Bill

Suggest an answer

Log in or Sign up to answer