Updating the issue status in a database
In this recipe, we will quickly see how to update the status of an issue in the JIRA database.
Getting ready
Go through the previous recipe to understand the workflow-related tables in JIRA.
How to do it...
Refer to the following steps to update the status of an issue in JIRA:
Stop the JIRA server.
Connect to the JIRA database.
Update the
issuestatus
field in thejiraissue
table with the status you need:UPDATE jiraissue SET issuestatus = (select id from issuestatus where pname = 'Closed') where pkey = 'DEMO-123';
Modify the
step_id
column in theos_currentstep
table with the step ID linked to the status you used in the previous step.step_id
can be found in the workflow XML alongside the step name within brackets, as shown in the following screenshot:As you can see, the status Closed in the JIRA default workflow is linked to the closed step with an ID value
6
. Now, thestep_id
column can be updated as follows:UPDATE os_currentstep SET step_id = 6 where...