Updating 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 follow steps to update the status of an issue in JIRA:
Stop the JIRA server.
Connect to JIRA database.
Update the
issuestatus
field injiraissue
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
in theos_currentstep
table with the step ID linked to the status you used in the previous step. Thestep_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
can be updated as follows:UPDATE os_currentstep SET step_id = 6 where entry_id = (select workflow_id...