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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

ScriptRunner for Jira Cloud - Send email when a custom field gets a certain value

I am a Beginner in Script runner: 

I would like an email to be sent to the Reporter in the Jira issue automatically if a custom field is set to a certain value. 

E.g. If the Service Desk agent finds that the issue is not in-compliance with data privacy they will set a custom field to "Not in compliance". 

If this happens we would like a predefined email template to be sent out to the user in the reporter field. 

Link to a similar example, or just a detailed how-to is appreciated :-) 


1 answer

1 accepted

0 votes
Answer accepted
Vikrant Yadav Community Leader Aug 05, 2022

Hi @Sigrid Kviteberg  As you are using JIRA Cloud, Using Project Automation you can easily setup Mail notification to Reporter based on Custom field value. 

If you still need Script runner, then try below code :- 

I tested code in Script Runner post function "Send Notification", 

Condition :- 


//define custom field ID from the field where you want to get the value of
def customFieldName = 'customfield_10029'

//create API request to get custom field value
def result = get("/rest/api/2/issue/${issue.key}?fields=${customFieldName}")
.header('Content-Type', 'application/json')

if (result.status == 200) {
result.body.fields[customFieldName].value.toString() == "100.0"
} else {
return "Error retrieving issue ${result}"

Message :- 


"""Dear ${issue.fields.assignee?.displayName},

The ${} ${issue.key} with priority ${issue.fields.priority?.name} has been assigned to you.

Description: ${issue.fields.description}




Thanks @Vikrant Yadav . My issue with the automation is that it will check the field value and send an email, but the next time it is scheduled to run it will send a second mail if the issue has been updated in the meantime. 

I have also tried checking on a field value, but my only options are to send an email if the field value changes - I can not select to send an email for a specific value entered in a field, and I am looking for separate emails to be sent for different values in a field.

There might be another way in the automation, but I will try out your Scriptrunner anyway as I am sure it will be useful in other cases. 

Thank you! 

@Sigrid Kviteberg  In Project Automation , you can use "Field Value Change" Trigger type >> Apply Condition if customfield value = Not in compliance >> Action "Send custom email". It send email only when custom field value set to "Not in compliance". 

@Vikrant Yadav .... I should have asked about this several days ago :-D 


Like Vikrant Yadav likes this

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events