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

Your Points Tracker
  • 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
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?
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

Jira automation, script runner, how to add value to new created worklog attribute? Edited

kkoziol I'm New Here Apr 29, 2021
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.tempoplugin.common.TempoDateTimeFormatter
import com.tempoplugin.core.datetime.api.TempoDate


WorklogService worklogService

InputWorklogsFactory inputWorklogsFactory

def startDate = TempoDateTimeFormatter.formatTempoDate(

def worklogManager = ComponentAccessor.getWorklogManager()

def worklogs = worklogManager.getByIssue(issue)

// Add all fields needed to create a new worklog
def timesheetWorklogBean = new TimesheetWorklogBean.Builder()

def inputWorklogs = inputWorklogsFactory.buildForCreate(timesheetWorklogBean)


This script is run in automation step. Got error: Work attribute 'Kategoria pracy'(_test1_) is required. This is work attribute in Jira Tempo



Zrzut ekranu 2021-04-29 133711.png


Zrzut ekranu 2021-04-29 134000.png

What to add to:

def timesheetWorklogBean = new TimesheetWorklogBean.Builder()


To make it choose "Brak" in "Kategoria pracy"????

1 answer

1 accepted

0 votes
Answer accepted

Hi @kkoziol ,

Is Work attribute 'Kategoria pracy'(_test1_)  is custom field?

You may help below code :-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManafer = ComponentAccessor.getIssueManager()
def userManager = ComponentAccessor.getUserManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def userToSet = userManager.getUserByKey("userkey")
def userCf = customFieldManager.getCustomFieldObjectByName("user picker") //custom field name

issue.setCustomFieldValue(userCf, userToSet)
issueManafer.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
kkoziol I'm New Here Apr 29, 2021

Hi, this is not custom field. It is work attribute in Jira Tempo

 Zrzut ekranu 2021-04-29 140250.png

Hi @kkoziol ,

Oh! Its Jira Tempo plugin. I'm afraid this is not possible at the moment.

You check from below script runner snippet :-

Suggest an answer

Log in or Sign up to answer

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