Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the value of a custom field via post function

Tim H_
Contributor
January 28, 2024

I have a custom field called "Region" with list values (A, B, C for the sake of simplicity). Now I want to achieve this: Whenever I execute a certain transition, e.g. "Delegate to Region A", the value of the field should change to "A".

I'm using Jira Service Management Data Center and would like to use a post function for this. I can select the post function "Update issue field". However, I don't see "Region" in the dialogue. Any ideas?

Probably, I could use automation rules. But I would prefer to use post functions as automation rules would affect all workflows and not only this specific ones. I think, automation rules are a bit error prone.

Any help is greatly appreciated!

2 answers

0 votes
Suprija Sirikonda _Appfire_
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.
February 15, 2024

Hi @Tim H_ ,

If you've the Jira Misc Workflow Extensions (JMWE) app installed in your Server/DC instance, you can achieve your requirement by following below steps:

  1. Add JMWE Set issue fields post-function on the desired transition (Ex: Delegate to Region A) of the workflow.
  2. Select "Region" for "Add field"
  3. Add the desired value

BTW, I'm from Appfire, the vendor of JMWE app.

Regards,

Suprija | Appfire

Nigel Jewell April 16, 2024

Hi Suprija.  Is there a way to set a field as part of a custom script, not using the "set issue fields" function?  Something like ...

 

{%if condition %}
issue.fields.customfield_13747 = "123"
{%endif%}

 ?

0 votes
John Funk
Community Champion
January 28, 2024

Hi Tim,

1. What kind of field specifically is the Region field? 

2. Do other fields of the same type show up?

3. Is there anything in the Context for the field that would make it not show up for that workflow? i.e. the workflow is attached to an issue type that is not included in the Context

4. You can put conditions in Automation rules so that not all workflows would be subjected to the rule. 

5. Can you explain more about how automation rules are a bit error prone? That's not been my experience. 

Tim H_
Contributor
January 28, 2024

Hi John,

thanks for your reply!

1. It is a list of predefined text values, one of which hast to be selected.

2. Custom fields generally don't show up. Only several system fields as well as three fields that have something to do with the estimated time for a solution.

3. The field is defined for (and used in) the project. Other fields with a similar configuration don't shop up as well. Neither do fields that have a global context.

4. Thanks. I know that, but I fear that this may become very complicated. Especially when I have more and more automation rules.

5. I fear that I could lose track on all those rules. So, the rule automation would not be error-prone per se. But *my configuration* could be error prone, to be more precise. Also, rules don't take immediate effect. Sometimes, a refresh is needed. That's could confuse the agents.

Again, thank you very much for your suggestions and clarifications!

Tim H_
Contributor
February 14, 2024

@John Funk Any ideas how to solve this? 

I implemented an automation rule as a workaround. However, as expected there are some side effects. The rule is executed in situations in which it shouldn't have been. I may be able to add some conditions to the rule, but actually a post function would exactly be what I need.

John Funk
Community Champion
February 14, 2024

You are probably going to need an add-on then for the workflows to get the field to be available. Something like JMWE or ScriptRunner. 

If you want to post the automation rule here for review and suggestions on the conditions, feel free. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.15
TAGS
AUG Leaders

Atlassian Community Events