Does anyone have examples to use script runner to automate/define a custom field within a workflow transition so that the executioner gets displayed on that custom field based from each workflow transition?
In a quick nutshell, we are defining our Change Control Process, so that TR/SR/MgrApprovers names get stamped/defined at these new custom fields and from what I was told from our vendors was to use Script Runner. Any thoughts would be greatly appreciated? Not sure if this is the right place to ask these questions, so here goes and/or if not, who do I contact?
If only a specific person (like assignee) can transition the issue, you can use JIRA Suite Utilities' Post Function (Copy Value From Other Field).
To do this;
You can do that with script runner but if you want an example on how to do that would you provide some more details, as I'm not really sure what exactly you want to see on the issue view screen ?
The user who executed the transition is stored in the issue history and you can view it without adding a custom field.
See https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/postfunctions/set-issue-attributes.html for how this would work in principle what you would need would be a line similar to
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
def userCf = customFieldManager.getCustomFieldObjectByName("<your user field>")
Wow~! ... thanks for your splendid feedback, this is great stuff! Never really used this portal as I've been pretty much just diving in and administrating JIRA by google and such. I'll come here more often
@Phill Fox [Adaptavist] I'll review your comment and try that out. For the rest, thank you and greatly appreciate it!
So Basically ... ;
The objective of the additional fields is to capture who and when the CCP (change control process) was reviewed and approved. The current workflow captures this only in the comment field and if the person didn't leave a comment, then there's no trace of who did what unless once looks at the history tab. To get this going for the team, I've made the comment field as required to get them by though upper management still wants a custom field in place to plugin, so when they pull their reports and such from a dashboard.. that info will be there.
In your workflow on the appropriate transition, add a post function.
The simplest JIRA Workflow toolbox function to use is probably the "Copy a parsed text to a field".
In the parameters screen for the function:
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG