Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
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

Setting Tempo Account field to default value with ScriptRunner

I have come across multiple questions related to this topic, but I have been unsuccessful in implementing any of the recommended solutions.

The thread most closely related appears to be:  https://community.atlassian.com/t5/Jira-Core-questions/Tempo-Account-field-values-with-Script-Runner/qaq-p/296415

But there is no real clear solution provided.

I am simply trying to assign a specific Tempo Account value when a new issue is created based on the issue type itself.  I have no issues setting any system field/value default, but when I attempt to set a Custome field/value and specifically the Account field/value, I cannot get it to work properly.  The Code Block below is set to trigger the behaviour on the create action for a Defect in this project.  I am trying to set the value of the Account field to the "General" Account.  The syntax seems to be correct, but I still get an Account value of "None" when I attempt to create the issue of type Defect.  Any additional guidance would be welcome.

 

import com.atlassian.jira.component.ComponentAccessor

if (getActionName() != "Create Issue") {
return // not the initial action, so don't set default values
}

// set a select list value -- also same for radio buttons
def defectAccount = getFieldByName("Account")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(defectAccount.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionToSelect = options.find { it.value == "General"}
defectAccount.setFormValue(optionToSelect.optionId)

 

1 answer

HI @Chris Roberts 

Have you fixed this?

Same question. Do you have a solution for this? @Chris Roberts @Yogesh Mude 

Hello @Julia K ,

I used the JMWE app post function to set the Tempo account.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - April 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

273 views 3 20
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