Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner: list the worklogs on an issue in a web panel Script fragment

1) is it possible to use a scriptfragment (web panel) to display the issues worklogs

2) Does anybody have an example on what needs to be in the provider Class/script to display a list of worklogs

 thanks

4 answers

1 accepted

2 votes
Answer accepted

Hello, @Bart Geens 

1) Yes it possible.

2) You'll need to get worklogs via WorklogManager and create htlm to draw table, based on worklogs.

Here is example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)

 If you locate the panel at atl.jira.view.issue.right.context, it will look like this:

image.png

Thanks for the example!

Hello, Bart,

1) Yes, it possible

2) You need get worklogs via WorklogManager. and create html code that draw you table
Here is example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)



If you locate it at atl.jira.view.issue.right.context, it will be looks like:

image.png

Thanks Markov,this works for me

Hello, @Bart Geens

1) Yes it possible.

2) You'll need to get worklogs via WorklogManager and create html to draw table, based on worklogs.

Here is an example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)

 If you locate the panel at atl.jira.view.issue.right.context, it will look like this:

image.png

@Mark Markov , Is it possible to display the linked issues of particular link type and its status under Web panel? (Script fragment)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

109 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you