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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Auto populate values based on another custom field

Hello,

I have a custom field "Risk Value" which is a Number field.

I have created another custom field "Risk Level" which is a Text field.

I want to populate values in "Risk Level" whenever a value is entered in "Risk Value". (Event: Issue Created)

Scenario:
1. If Risk Value takes: 0-5,
Risk Level is equals to Low,
Else if Risk Value takes : 6-10,
Risk Level is equals to Moderate
Else if Risk Level is equals to High

I tried to create an event based and added some groovyy expression, but I'm not getting any result when I'm creating a new ticket.

What I have done so far:

impediment.PNG

Can anyone please advise what is wrong with the expressions or whether this is achievable?

Thanks.

5 answers

1 accepted

2 votes
Answer accepted

Hello @Joseph Chung Yin  & @David Fischer _Appfire_ ,

Thank you very much for your answers.

I have removed the "" from the expression, the logs is showing success but the field Risk Level is still not displaying in the ticket created.

I'm sharing with you my workings:

Category1.PNGCategory2.PNGCategory3.PNGCategory4.PNG

Category5.PNG

Do you have an idea why the field and its value is not being displayed?

Note that the field Risk Level is a non editable field

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 21, 2023 • edited

Hi @Krishtee 

what do you mean by "the field Risk Level is a non editable field"? What is the custom field type, and how did you make it non-editable? Normally, to make it non-editable, you remove it from the "Edit" screen, is that what you did?

Hello @David Fischer _Appfire_ ,

Yes I have removed the field from the edit screen because the value will be dependent on the value of field “Risk Value”.  Users should not have the possibility to modify the value.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 21, 2023

And what is the custom field type of that field?

It is a text field

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 21, 2023

A regular, single line text field? Not a read-only text field? In that case it should definitely work. You can click on the green checkmark to see the execution logs and make sure the event-based action ran on the issue you think it did.

Yes it is a regular text field which I have just removed from the edit screen.

Yes, the log is showing successfully completed and is referring to the correct ticket and issue type.

But despite being executed successfully, the field is not present in the ticket.

That's what I'm not able to figure out why the field Risk Level and its associated value are not being displayed.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 21, 2023

And did you make sure it's on the "View" screen? 

Also, one thing you could do to test further is add default value, adding this as the last line:

else return "VALUE DID NOT MATCH"

and check if you then see the field.

Yes the field is available on the view screen.

As you mentioned, I have added the last line and effectively it is outputting the result "Value did not match". The Risk Value is 7 and it should have displayed Medium for the Risk Level 

Category6.PNG

Can you advise why it is not performing the if and else if section?

@David Fischer _Appfire_ When I'm updating the values of "Risk Value" for an existing issue of issue type "Impediment", the rule is working correctly.

It's only when creating new issue of issue type "Impediment", the rule is executing the else section (That is it is returning: "VALUE DID NOT MATCH")

I have managed to make it work.

I have changed the event of the trigger to Generic Event instead of Issue created.

Thanks a lot for your help :)

1 vote
Tim Kopperud
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.
Oct 21, 2023

Hi @Krishtee  I understand you try to accomplish this using a post function. I see two obstacles here 

  • What if you want to change the Risk value without transition the issue? 
  • As I understand it, to support this approach you will need this script included in every transition you want to align Risk level with Risk value. 

Suggesting another approach

I might suggest using Automation to set Risk level based on Risk value. The automation example below should update Risk level, and also constantly maintain it correctly.

image.png

 

Don't have Automation for Jira?

If you don't have Automation installed I would recommend you get it because it really boost Jira to another level.  Automation for Jira is free. It is still downloadable for server

 

TimK.

Hello @Tim Kopperud ,

Thanks for your help.

I tried the automation with the rule 

When: Rule is triggered on

  • Issue Created
  • Issue Updated

If: Risk Value
between
0 and 5

Then: Edit issue fields
Risk Level

This rule was returning the correct value but only for the triggger Issue Updated. It was not returning the value for the trigger Issue Created

Tim Kopperud
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.
Oct 22, 2023

Hi @Krishtee, That was strange.

I tested the rule using the Issue created trigger. The rule now looks like this:

image.png

The newly created issue was updated as shown below: 

image.png

So, it works as expected.

Can you attach an image of your rule? And an image of the the entry in the Audit log? It will be helpfull for further investigation of why it doesn't update the Risk Level on "your side". 

TimK.

1 vote
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 20, 2023

Hi @Krishtee 

since the Risk Value field is a Number field, the constants you use in the Groovy expression should be numbers, not strings (e.g. 0 instead of "0")

0 votes
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 20, 2023 • edited

@Krishtee -

One other suggestion - 

Try to use the following code when testing for Number custom field

issue.get("customfield_12710") == 0 instead of issue.get("customfield_12710") == "0"

Your current code typically is checking for non-Number field value.

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

0 votes
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 20, 2023

@Krishtee -

Can you provide the entire post function screen (i.e. Target issue section etc)... Secondly, have you turn on debugging against the add-on and see what is captured (i.e. errors) in the system's logs?  Also have you included your 2nd custom field in your issue screen for your issue type setup?

You can also reach out to JMWE vendor for technical support.  Based on my experience with the vendor, they are really good on assisting users with technical questions too.

Please advise.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events