How do I run a script when the value in the customfield?

Hello.
How do I run a script when the value in the customfield, if the value to which the change is unknown to me.
Is that possible? Thank you in advance.

1 answer

0 vote

Could you give us more detail on:

  • when this should run.  "a value in a field" does not tell us when you want to do it.  (Think of it this way - I wrote "dave" on a note.  My note has a value of "dave".  Do I run a script when I write the note, when I throw it away, or every second that "dave" is on it?)
  • You say "if the value to which the change is unknown".  That's not an English clause, and hence makes no sense.  At a guess, you are trying to say that you want to update a custom field with some data, but the clause implies that you do not know the data.  This will not work.  Imagine that you hire someone to paint a wall.  They come to your house and ask "what colour do you want the wall?".  When you say "I don't know", they cannot do it.  That's what you have done to us here.

I'll try to explain.
I have a drop-down list, the script should be triggered when any item.

That's how I'm trying to implement it:

log.setLevel(org.apache.log4j.Level.INFO)
log.info("Start");

IssueManager issueManager = ComponentAccessor.getIssueManager();

def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "customfield_10200"}
if (!change) {
log.info ("Developer changed" + change.oldstring )

log.info ("Developer changed" + cchange.newstring )
}

 

But the mistake: java.lang.NullPointerException: Cannot get property 'oldstring' on null object

I'm doing something wrong, but I can not figure out what it was.

 

>the script should be triggered when any item

when any item what?

Your code is from a listener though, and it needs a tweak if I'm understanding what it's for.  Try

change.get("oldstring")

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

70 views 0 5
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