Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to identify which workflows use a given status property?

I need to bulk change issues across many different projects and workflows, but some of them have the issue.editable property set to false and it is preventing me from performing the operation. Ultimately, I need to edit these issues.

From my understanding, the way to do that is by editing each status in every workflow with the editable property set to false and then performing the change, and then setting the properties back afterwards. If this is true, is there a way I can quickly identify workflows that utilize this property?

 

Otherwise, is there another way to circumvent this property and perform the changes I need to perform?

1 answer

1 accepted

Hi Karl!

So, this is actually a rather difficult question because the properties are nested in the status within the workflow. I can't figure out a way to get at that info from the REST API, nor from the DB Console (though I'm sure there must be some way). There may be some way to do it with ScriptRunner, I will look into that and report back.

Based on what I'm seeing, your best bet might be doing an XML backup of the system, isolating the workflows in a text editor, and searching for the jira.issue.editable property.

Edit:

After a bit more work and research (thanks to this article especially), I managed to figure out how to do this using ScriptRunner. Running this in the console should print a list of workflows (and which status) with the jira.issue.editable property set to false:

import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.StatusManager
import com.atlassian.jira.workflow.WorkflowManager

def log = Logger.getLogger("WorkflowProperties")
log.setLevel(Level.DEBUG)

StatusManager statusManager = ComponentAccessor.getComponent(StatusManager)
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager()

def workflows = workflowManager.getWorkflows()
for(workflow in workflows){
def statuses = workflow.getLinkedStatusObjects()
for(status in statuses){
try{
Map attributes = workflow.getLinkedStep(status).getMetaAttributes()
attributes.each{ k, v ->
if(k == 'jira.issue.editable' && v == 'false'){
log.debug "${workflow.getName()} - ${status.getName()}"
log.debug "${k}:${v}"
}
}
}
catch(e){
continue
}
}
}

 

It's worth looking at the article I linked to above, as it includes some code for adding a property, which I think could easily be modified to change the property to true, allowing you to automate this whole process rather than manually going through and changing that property in every workflow.

Hey Jaron,

 

This answer is exactly the sort of thing I was looking for and the resource you linked is a godsend! 

 

Thank you for taking the time to solve this dilemma that had given me so much difficulty!

Like Jaron Stevenson likes this

Awesome! I'm glad I could help!

I recently had to use this, so it came around! Just for posterity (though effectively the same information is found in the answer I linked to), to change or add properties you would just insert a couple lines of code to the above, in the loop through the attributes map, as follows:

attributes.each{ k, v -> 
  if(k == 'jira.issue.editable' && v == 'false'){
    log.debug "${workflow.getName()} - ${status.getName()}"
    log.debug "${k}:${v}"

// This line adds the specified key-value pair to the map
// Or updates an existing value if the key already exists
    attributes.put("jira.issue.editable","true")

// Sets the workflow step's attributes.
    workflow.getLinkedStep(status).setMetaAttributes(attributes)
  }
}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you