Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to use scriptrunner to get the workflow's node status value ?

yundong.li
Contributor
March 9, 2022

I am not good for Scriptrunner,but need to use it urgently to solve problems.

Can someone give an example for the problem as this:

How to do to get the current issue' ID ?

how to do to get the current issue's workflow translate and node status ?

how to do to get the current issue's sub-issue or parent-issue ?

how to do to get the current issue's field's value and change it. 

and so on .

I know the links of learn scriptrunner, but unfortunately, I didn't have much time to get acquainted with it

thanks very much!

 

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
March 9, 2022

So most of your questions are out of context, all we can really say is "where"?

For example, when you ask

Where do I get the current issue ID?

The answer depends on where you are running the code.  In the console, listeners, email handlers and so-on, current issue id could be anything, it depends on what you're coding for.  In post-functions, it's easy, the context contains simply "issue", which is the issue object for which you're running the transition (and you probably don't even care what the issue ID is, because "issue" contains the entire issue already, so you can use it directly and not need to look anything up)

For a listener, "current issue" probably means "the issue for which this event was fired", and you can get the issue object from event.issue, but some events happen without an issue.

Now, assuming you have worked out what issue you are working with, the answers to the others within that context are:

issue.getStatus()

issue.getSubTaskObjects()

issue.getParentObject()

Customfields are a bit more complex, start with a look in https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console

And do feel free to rummage through that library for more scripts

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events