Is the only way to move the transitioner name into a custom field to write a script?

Phil Bustin May 16, 2022

Is the only way to move the transitioner name into a user picker custom field to write a script?  If so, how do I write and apply the script?  My post functions are:

1. Set issue status to the linked status of the destination workflow step.
2. Add a comment to an issue if one is entered during a transition.
3. Update change history for an issue and store the issue in the database.
4. Re-index an issue to keep indexes in sync with the database.
5. Fire a Issue Created event that can be processed by the listeners

 

1 answer

0 votes
Wouter Bruinings
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.
May 16, 2022

Hi @Phil Bustin

Have you tried using Jira Automation in the project you want to apply this logic to? 

Trigger: on any transition
Action: Edit issue fields and select advanced using this json: 

{
"fields": {
"customfield_10037": { "id": "{{initiator.accountId}}" }
}
}

 To answer your question on how to add the script: 

You'll need one of the plugins that allow you to script, like PowerScripts or ScriptRunner. 

Phil Bustin May 17, 2022

Thanks.  Is either free?

Phil Bustin May 17, 2022

I see Advanced, but not sure where to go from there (list of actions is below).  I don't suppose Edit Issue would work?

Edit issue
Update certain issue fields.

Advanced

Create variable
Define a new smart value to use in this rule.
Delete attachments
Selectively delete attachments from issues.
Log action
Add value to the audit log.
Lookup issues
Search for issues using JQL.
Re-fetch issue data
Re-fetch any issues that have been updated
Set entity property
Sets a property on a given entity like an issue, user or project.
Phil Bustin May 17, 2022

1) It would appear that I can't simply select the custom field and update it; I have to select the advanced option, correct?

2) In the documentation for advanced, I see that I can use the actual field name instead of a field Id.

3) The documentation appears to indicate that the accountId is a smart field, and works as written.  Is that correct?  If I get as far as activating the workflow and trying it out, I may get my answer.

Phil Bustin May 17, 2022

When I tried to publish the rule, I got an error:

Additional fields contains invalid field(s) in 'update' or 'fields' section: Business Analyst Signoff

I resorted to selecting the field (not More options > json), and selecting myself as the value.  That worked.

What was wrong the the json I created (same  as your example, but with the name of the field instead of the field Id)?

 

Phil Bustin May 17, 2022


Wouter:

1) I saw documentation that says I can use the custom field name instead of "customfield_10037".  Do you think that's correct?  Again, when I tried that, it didn't work. 

2) If I try "customfield_10037", for which I assume I'd have to find the custom field Id and substitute it for 10037, where can I find the Id?

3) Is initiator.accountId the equivalent of the transitioner, and is 'accountId' sufficient, with no Id replacing it?

{
"fields": {
"customfield_10037": { "id": "{{initiator.accountId}}" }
}
}
      
 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events