Setting field based on Status and custom field


Is the following possible? 

When an issue has a set state and a field has a 0 value then add date stamp anther field. 

Ie issue in state ‘Closure’ and ‘Open Orders’ Field goes to 0 date stamp add in ‘project Spend Completed’ field

Any help or ideas would be great.



1 answer

1 accepted

Hello Kevin.

Yes this is possible, but should it be done? That's the real question.

You can do this two ways:

1. Create a listener

You make a custom listener that registers onIssueUpdated events.

That listener checks the project and issue type relevant to you. If it is you check that the value of your custom field has changed. If it has you check that it's zero, if it's zero you set the timestamp of your other field.

2. Incorporate this behaviour in a scripted field.

You make a scripted field as follows.

  1. Define a variable that contains the value of it's current state. Let's call this A
  2. Define a variable that contains the value of the other field. Let's call this B
  3. If A is null, and B is 0, return a current timestamp.
  4. If A is null, but B isn't 0, return null.


Both of this methods are quite heavy on your instance for something that you could do yourself. FE, you can create a REST endpoint that sets a timestamp to a field in an issue. Instead of setting a value to 0, you create a fragment that calls this rest endpoint when clicked.

Same thing, and less performance impacting on your instance.

If you need any help on this let me know.



Hi Daniel,

Thanks for the speedy answer.

The 'Open Orders' is imported information from our accounts system each night. 

Could option 3 still work?



You mean that it is ran automatically?

To be honest, if it's updated manually you need to go about this using listeners, if you want to keep it easy.

The more interesting route would be as follows:

Rest endpoint.

So your account systems at some point is calling the JIRA rest api via a script, I suppose.

If that is the case, you must have a list of the issues, or projects that you are updating. You can put that information in a JSON file.

With that JSON file, you can call another REST endpoint that does the calculation for the field, just after you do the import.

The rest endpoint would take that payload, and only do the calculations for the issues/projects necessary.

That is less performance affecting that anything else that I can think of.

Do you need information on how to go about this?

If so check our REST endpoints documentation:

And this answer of mine might help you craft a rest endpoint with authentifiation and JSON payload.

I hope this helped, if it did, please upvote my answer, and if it solved your problem, accept it so other users know this has been solved.



Hi Daniel,

This give me a lot of great information to go away and consider. 


Meny Thanks for all your help


A pleasure, this would be interesting to do when I'm on support, if you want any help, create a new question and tag me in it. I'd be glad to give you a hand.



Suggest an answer

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

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


117 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you