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

Script is not working as expected

Hi Team,

I have 2 select list fields( risk impact , risk occurence probablity)

I have created scripted field called risk level(calculated) and written down the below script, but not getting value in the risk level(calculated ) field , eve though no error in the script:

kindly please help:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import java.util.logging.Logger

Logger logger = Logger.getLogger("") ("I am a test info log")

Issue mainIssue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def riskimpact = customFieldManager.getCustomFieldObject("customfield_18484") as Integer

def riskoccprobablity = customFieldManager.getCustomFieldObject("customfield_18483") as Integer


if ( ( riskimpact * riskoccprobablity) == 0)
{ ("Value has been updated")
return 0
else if ( ( riskimpact * riskoccprobablity) < 4)
{ ("Value has been updated")
return 1
else if ( ( riskimpact * riskoccprobablity) < 8 )
{"Value has been updated")
return 2
{"Value has been updated")
return 3

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

How to create a Confluence page linked to a Jira cloud ticket

Have you been looking for a solution to easily create Confluence pages directly from a Jira Cloud issue? The no code solution is here with the brand new app Elements Publish to Confluence, which work...

58 views 0 2
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