direct issue creation and invalid data in database

Hi All,

I am trying to use the direct issue creation feature as discribed below

https://confluence.atlassian.com/display/JIRA052/Creating+Issues+via+direct+HTML+links

we have a sepate page that auto complete the form and submit to jira via POST method to CreateIssueDetails!init.jspa

some jira projects we have are complex and it is possible that the form may not be complete. That is

1. required fields may not be filled

2. fields that accept only accept "YES" and "NO" might be filled with some thing else

when this thing happens the form will come with a warning that some required fields are not field or some other fields have invalid data. This is fine, the second step for the user is to complete the missing part and submit the form. so far so good.

But before the user corrected the form and hit submit. The server has already pre-processed the request and created initial entry in the database (like id, reporter, summary...). Lets say if the user did not do the second step, then we are left with inconcistent data in our database.

My expectation is that the server would reject any incomplete request and do not initiate entry creation until the form is complete. May be this is a configuration issue or something else. Is there something we can do to avoid this.

3 answers

0 vote

Your expectation is correct - if the initial POST fails because you've missed a mandatory field, Jira won't create the issue. So your database will be consistent, because it's not been added to!

Hi Nic,

Even I have seen this issue .... Database doesn't remain consitent as in the database you can see issue getting created in Jira issue table with a null PKEY.....

and other value will be populated like "reporter", project , priority,issuetype etc.

Also these issues will be part of jiraaction table as well.

Sometime this may result into disabling the background re-index feature

So finally you have to delete all these issues from the DB which has NULL PKEY to retain the JIRA's Feature.

Hope this helps... Please let me know if there are any other way to tackle this problem.

I use below query to remove such issues ::

DELETE FROM jiraaction WHERE issueid in (select ID from jiraissue where pkey is null);

DELETE FROM worklog WHERE issueid in (select ID from jiraissue where pkey is null);

DELETE FROM changegroup WHERE issueid in (select ID from jiraissue where pkey is null);

DELETE FROM nodeassociation WHERE SOURCE_NODE_ID in (select ID from jiraissue where pkey is null) AND SOURCE_NODE_ENTITY='Issue';

DELETE FROM userassociation WHERE SINK_NODE_ID in (select ID from jiraissue where pkey is null) AND SINK_NODE_ENTITY='Issue';

DELETE FROM customfieldvalue WHERE ISSUE in (select ID from jiraissue where pkey is null);

DELETE FROM OS_WFENTRY WHERE ID in (select ID from jiraissue where pkey is null);

DELETE FROM OS_CURRENTSTEP WHERE ENTRY_ID in (select ID from jiraissue where pkey is null);

DELETE FROM OS_HISTORYSTEP WHERE ENTRY_ID in (select ID from jiraissue where pkey is null);

DELETE FROM jiraissue WHERE ID in (select ID from jiraissue where pkey is null);

DELETE FROM notificationinstance WHERE SOURCE in (select ID from jiraissue where pkey is null);

Thanks,

Sumit

Ok, two things.

1. Do NOT mess with the database like that. Ever. You can destroy your Jira. Even if you decide to risk it, you need Jira backed up, offline, and then a full re-index after you've run SQL.

2. The actual problem. Your POST of data creating the issue is NOT in error. The post is creating a perfectly valid Jira issue. There's no need to clear it out. The problem is that you've got additional validation that Jira is skipping because you're not doing it in the standard configuration.

Can I ask what fields you are trying to put data into, what types are they? How are you doing the validation if you go into Jira and create the issue in the UI?

My issue and Bin's issue are on different instance and I was not even knowing him before this question came.

Actually it should not matter how you are doing the validation .. jira ideally should not allow issues on jiraissue table with null PKEY...because there in no importance of such issues when it comes to end users perspective since they won't be available at all to them.

The question "Why they got generated ?" I really didn't got much time to investigate the issue beacuse , I removed them from DB and now trying to write a trigger which can inform me whenever any such entry is made in Data Base.

I am pretty new to JIRA and there can be a lots of things which I might not be knowing so probably I am missing someting somewhere.

Thanks,

Sumit

It also sounds like something else is creating bad issues then.

The validation DOES matter, because it should be stopping that, and if you're usign Jira without any dodgy hacks, it WILL stop broken issues being created.

I think it's time to step back and look at the whole system, because those POST calls in themselves are not causing the issue.

Thanks Nic and Sumit for your quick response. This gives me enough direction to proceed.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

157 views 0 2
Read article

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