Validate on edit

Good day. I would like to be able to validate issues on edit. I have access to the source code of JIRA. Could you advise: in what class I should make changes?

Hi @eugene_kopyev,

Could you give some more information on your use case?
What do you want to validate and how would you validate it?

Hi, @pvandevoorde. I need to forbid editing of an issue when a certain field is equal to the specific value. I would like to implement validations on edit, working similar to validations on transitions.

So the “easy” way would be to use the jira.issue.editable workflow property ( see https://confluence.atlassian.com/jira/restricting-edit-based-on-issue-status-121422.html ) to restrict the editing and create a loop back workflow step where you can use the validators to validate the fields on a screen. This wouldn’t require any coding (but it might not be the most user friendly).

After that it gets nasty real quick. You could go the javascript approach and just have the a snippet of js on all of the pages - intercepting the edit click and then validate things that way. Of course if you disable javascript - then you can get it around it. And that won’t fix rest calls.

I thought you could be able to do a CustomField (since it would get all of the parameters on the page - but after an hour of looking - I haven’t found the right incantation of that yet).

I would highly recommend going the loop back approach because otherwise you’d be hacking at the core IssueService class which I wouldn’t recommend.

(I’m hoping somebody else has some brighter ideas than me though)