Updating text field with current user

Richard Jones September 1, 2015

Hi All

I'll simplify my requirement so it may not make complete sense as to why I want to do this. 

I have a custom multi line text field. I would like to populate this with the current user when a certain transition happens in my custom workflow. Is this possible?

Thanks

2 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 1, 2015

Strictly, no, because the current user is a user object, not a block of text.  The best you could do is convert the user object to a string representation in a post-function and drop that into the text.  But it will no longer be a user, just some information about that user in plain text.

You will need some code too - I'd write a script-runner post-function to do it, but it would be quite short, as extracting a user name and/or login is quite simple

Richard Jones September 2, 2015

Hi Nic, yep the name is all I want really. And probably the time that the transition happens.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2015

That's possible, you'd just tack on "now, formatted" into the string in your code.

Richard Jones October 9, 2015

Hi Nic, for your comment "I'd write a script-runner post-function" do you mean within the JIRA UI or as a python file which I can drop on the server?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2015

Neither. As Zezeto has said, you use a scripting add-on. I use the script-runner because it's been the most powerful one for many years (with the caveat that with great power, comes great responsibility - you must understand JIRA before you try to write your own scripts) and I've got used to it. Also, I now work with Jamie, so when I get stuck, I can directly ask his team for help, but I'd have said the same thing even if I didn't.

0 votes
Nadir MEZIANI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 1, 2015

Hi,

Yes you can do it using scripting utilities plugin like

Jira Scripting Suite

ScriptRunner for JIRA

JJupin

 

Suggest an answer

Log in or Sign up to answer