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

How to set a specific value of the Tempo Account Custom field on the target issue during the cloning postfunction

When a specific transition is executed I have a Postfunction, that will Clone the isse to a different Project, change issuetype and link the issue to the original one. For that I am using the Scriptrunner Postfunction, "Clones an issue and Links"  - This work as intended..

During the cloning, I also need to set a specific Account for the Target issue.

The "Set Custom Field" example (See image) provided in the post function does not work as I am trying to set a string Value in a Custom field that accepts an Account Object. Therefore I need to create an Account object before.

My programming skills are far from sufficient, so I'm hoping that someone can help me writing the script to add to the Additional issue action section.

 Postfunction_CloneAndUpdateAccountOnTargetIssue.PNG 

3 answers

1 accepted

2 votes
Answer accepted

It proved to be too hard, for me to find out how to create the account Object. The Tempo helpdesk does not support custom scripting and could not help me creating the needed Account Object.

I decided to go for the workaround, suggested by Adaptavist service des, to get teh Value of the customfield from another issue that hold the desired value in the custom field.

With my limited progamming skills i managed to put the following together, which does the trick...

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue; 

IssueManager issueManager = ComponentAccessor.getIssueManager();
CustomField customField_name = customFieldManager.getCustomFieldObjectByName( "Account" ); // CustomfieldName
def issue_x = issueManager.getIssueObject("UD-3483") // Issue ID from which to inherit value from
def value = issue_x.getCustomFieldValue(customField_name) //Retrieves value from defined custom field from specified issue
issue.setCustomFieldValue(customField_name, value) //Writes retrieved customfield value in to target issue

The tempo guys would need to explain how you retrieve an Account object. The closest I could find is https://answers.atlassian.com/questions/36114783

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

320 views 9 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