How to copy the value of one of my custom fields to another field (comment) based on a specific transition.

I have created custom field for input textbox and associated with one of transition screen.

After executing transition action, i need this custom field value to be added on comment of that issue.

I could not find any related post condition or even - "copy from other" also does not show "comment" in destination field.

please suggest how it could be possible.

3 answers

you can write your own postfunction. see https://developer.atlassian.com/display/JIRADEV/Workflow+Plugin+Modules#WorkflowPluginModules-Functions

Issue issue=transientVars.getIssue();
Object var1=issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("<your text field>"));
JiraAuthenticationContext authContext=ComponentAccessor.getJiraAuthenticationContext();
if(var1!=null)
{
   ComponentAccessor.getCommentManager().create(issue,authContext.getLoggedInUser().getName(),var1.toString(),false);

ComponentAccessor.getIssueManager().updateIssue(authContext.getLoggedInUser() , issue, EventDispatchOption.EventDispatchOptionImpl.ISSUE_UPDATED , false);

ComponentAccessor.getIssueIndexManager().reIndex(issue);
}

you can put the above code and check in execute() method of workflow postfunction module.


Also see http://www.j-tricks.com/1/post/2010/08/workflow-post-function.html

Or directly execute your given code in jira administrator somewhere to allow me to appear post condition script execution.

Is this not possible to do this directly on jira administroator UI...?

i don't want do create any plugin or code for that.

0 votes
Thomas Schlegel Community Champion Nov 19, 2013

Hi,

Jira Workflow Toolbox-Plugin has a workflow post function called "Add a comment". This is exactly doing what you describe above.

The plugin is not free, it is commercial.

Cheers

Thomas

Thanks for sharing.

I need free one only.

same question here

https://answers.atlassian.com/questions/163707/custom-field-value-to-comment

and also check this

https://answers.atlassian.com/questions/152004/groovy-post-function-create-add-comment-with-custom-field-value

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,755 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot