Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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!


How to store custom project properties in jira using scriptrunner

I'm trying to store custom project properties in Jira server via scriptrunner, but had no success. I found this link that shows how to retrieve a project's properties

However, I couldn't find any post to store. Any help will be appreciated.

2 answers

1 accepted

0 votes
Answer accepted

Found a solution after tinkering and going through the java docs. Here is a simple solution that got it working. Needs proper error handling and whatnot.

NOTE: the value must be some sort of a map type because it needs to be converted into a JSON format, or else it will not be a valid format after trying to troubleshoot the problem.


import com.atlassian.jira.component.ComponentAccessor
import io.atlassian.fugue.Option
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper

class ProjectEntityProperty {
def projectManager
def issueManager
String projectKey
def project
def reporter
ProjectPropertyService pps

ProjectEntityProperty(String projectKey, String userKey) {
this.projectKey = projectKey
projectManager = ComponentAccessor.projectManager
issueManager = ComponentAccessor.issueManager
project = projectManager.getProjectByCurrentKey(this.projectKey)
reporter = ComponentAccessor.userManager.getUserByKey(userKey)
pps = ComponentAccessor.getComponent(ProjectPropertyService.class)

def setProperty(String key, Map value) {
def json = new JsonBuilder(value)
def entityPropertyInput = new EntityPropertyService.EntityPropertyInput(json.toString(), key,, project.key)

EntityPropertyOptions entityPropertyOptions = new EntityPropertyOptions(true)
def validatePropertyInput = pps.validatePropertyInput(entityPropertyInput)
def setPropertyValidationResult = pps.validateSetProperty(reporter,, entityPropertyInput, entityPropertyOptions)

if(!setPropertyValidationResult.valid) {
// TODO: throw an exception
// and show something like
// log.warn(setPropertyValidationResult.getProperties())

EntityPropertyService.PropertyResult propertyResult = pps.setProperty(reporter, setPropertyValidationResult)

def getProperty(String key) {
EntityPropertyService.PropertyResult propertyResult = pps.getProperty(reporter, project.key, key)
Option<EntityProperty> jsonValues = propertyResult.getEntityProperty()
def entityProperty = jsonValues.getOrNull()
JsonSlurper parser = new JsonSlurper()
return parser.parseText(entityProperty.value)

def ep = new ProjectEntityProperty('SOME_PROJECT_KEY', 'SOME_JIRA_USER_KEY')
String key = 'com.something.example'
ep.setProperty(key, [myData: 'My data'])
return ep.getProperty(key)

 Another solution is to use Active Objects and the solution can be found here

1 vote
Jorden Van Bogaert
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.
Apr 19, 2022

Hi @Mazin 

I'm not sure how to store them via code, however, we use Enhanced Project Properties on our instance and it's working perfectly. And the best thing, it's free :D

We read the properties via code, so that works fine too. And storing goes via the UI which is much more user friendly for non-scripting admins.

It also comes with some additional features such as JQL search.

Hope this helps
Kind regards

Hi @Jorden Van Bogaert Thanks for your reply. Just learned I can't use any plugins, sadly.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events