Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to set a field value in post function? Edited

Request:
1. If "Resolution" value is Lost - need to choose a value for the Cause field.
2. If "Resolution" value is not Lost - the Cause field can be left as "None".

I know how to set a specific value for a field in the post function, but here they ask for the ability to select a value from a list type field after transferring to the Lost status.

2 answers

2 accepted

0 votes
Answer accepted

Hi Volodymr,

You can jira automation instead.  Take a look at this video on how to do it: https://www.youtube.com/watch?v=S2ary5YG-7w&t=7s 

In your case:

- Trigger: Value Field Change on Resolution field.

- Condition: A condition that checks the resolution field

- Action: Edit Cause field

Regards,

Fabian

Hey Fabian,
That will not work for me. We don't have this option in our Jira.

Hi Again,

I misunderstood your original request.  If you actually want the user to select based on another field, there is a way. 

1. Create a transition screen with the Cause Field and add it to the transition

2. Using Cprime Power Scripts with a  SIL script validator do the following: (You could also use a groovy script as well with any other plugin that provides a validator scripting )

---------------------

if (resolution == "Lost"){

  if (isNull(customfield_rootcause)){  // case when rootcuase is left empty

       return false,  "Error, root cause cannot be empty"

   }

  else {

     return true;

  }

}

else {

 return true; // they can choose any option

}

Conclusion:

- When a user clicks on the transition, the pop up will show up and the validator will show an error message only if the resolution was set to "Lost" and left root cauase is empty.  Note: in this example I'm assuming that the resolution was prior to the transition.

Sil validators details : https://confluence.cprime.io/display/JJUPIN/Customizing+workflows#Customizingworkflows-Forvalidators 

- If you want it to be live where users select on the resolution on the fly, you may want to consider using Live Scripts from Power Scripts: https://confluence.cprime.io/display/JJUPIN/How+Live+Fields+work 

@Fabian Lim  Thank you for the detailed instructions. I've done it almost as you described.
I totally forgot that we have JMWE app and your explanation was helpful to do a custom screen and if condition for the required transition.
The result is as easy as this - Fields Required Validator (JMWE app) and condition - issue.get("resolution")?.name == "Lost"
At the end I have this = If "Resolution" field is set to 'Lost', custom field 'Cause' becomes mandatory.

Glad to know that it worked.  JMWE, JSU and Power Scripts are all very powerful Add-ons for customized workflows.  

Like Volodymyr likes this
0 votes
Answer accepted
Jack Community Leader Jun 16, 2021

You will need an addon for automation or scripting. 

@Jack You're right as always. I did it with JMWE app. Thank you.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

116 views 1 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you