How to get Workflow Scheme ID

Hello,

I need to get a Workflow scheme for a current project, but trying to run code:

import com.atlassian.jira.component.ComponentAccessor

def SchemeID = ComponentAccessor.getWorkflowSchemeManager().getWorkflowScheme(issue.getProject()).get("id") 

 gives nothing.

JIRA v6.2.4

3 answers

1 accepted

0 vote
Hello,
Try this one
def SchemeID = ComponentAccessor.getWorkflowSchemeManager().getWorkflowSchemeObj(issue.getProject()).getId()

Cannot invoke method getId() on null object

I see.

Does your issue.getProject() return a value. Put log.error(issue.getProject) and have a look.

groovy.lang.MissingPropertyException: No such property: getProject for class: com.atlassian.jira.issue.IssueImpl

Try this code

 

import com.atlassian.jira.component.ComponentAccessor

def SchemeID = ComponentAccessor.getWorkflowSchemeManager().getWorkflowSchemeObj(issue.getProjectObject()).getId()
log.error(SchemeID)

 

It works for me

Yes, it does! Thank you for your help! :)
Been trying "issue.getProjectObject()" (as it is and also fetching key, name, id) since yesterday when I saw that "issue.getProject" is deprecated, but couldn't get anything and I don't know why.

But today logs show me normal output for

log.error(SchemeID)

and also for

log.error(ComponentAccessor.getWorkflowSchemeManager().getWorkflowSchemeObj(issue.getProjectObject()).getId())

...yesterday I've been trying only the last one.

Once Again - Thank you! :)

To get Workflow Scheme ID in Behaviuors

import com.atlassian.jira.component.ComponentAccessor

def ProjectObj = getIssueContext().projectObject
def SchemeID = ComponentAccessor.getWorkflowSchemeManager().getWorkflowSchemeObj(ProjectObj).getId()
0 vote
Jeremy Mooiman Community Champion Nov 06, 2017

Dear Aleksandr,

When you edit a Workflow Scheme, you will see its ID in the URL.

Friendly Regards,

Jeremy Mooiman

Can I do this in python?

would I have to do an api call?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

765 views 2 19
Join discussion

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