Text Validation plugin


I am trying develop a plugin which checks all user input fields on JIRA for a particular regular expression and then prevents the user from posting that on JIRA by alerting them. For example: Let the regular expression be for a phone number, the plugin should check all input fields on JIRA and prevent the user from posting it by alerting them that they are trying to post a phone number which is not allowed.

How should I approach this?

Thank you!

You’re going to have the same issues as Redact PII on Confluence :frowning: You can do it - but it will be a lot of work to do it properly.

You can just go the javascript route (take a look at https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/downloadable-plugin-resources - the context you’d be looking at is atl.general) and just have some javascript that overrides all form submissions and does the validation there prior to it submitting it. The issue with this is that there are some functionality that don’t use forms (they use input fields - but not the form for submission) and instead just passes things through javascript/ajax directly to the rest api. Which brings us to the “real” fix…

In order to do it properly you’ll have to intercept the IssueUpdated event in java but since this is happening after the update - you’ll need to take a look at https://docs.atlassian.com/jira/7.0.8/com/atlassian/jira/issue/changehistory/ChangeHistoryManager.html and then update it as well as any other places that might have it.

In the end it’s very much going to be chasing your own tail. :frowning: My suggestion would be to narrow where you want to validate the data(in that case you might be able to do the javascript route). Take a look at perhaps making your own custom fields? Or perhaps a workflow validator ( https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/workflow-plugin-modules ) so that you can block an issue from transitioning.


Thank you. I will follow that trail and let you know how it goes :sweat_smile:

I have a question: How do I reconcile the deprecated functions (of which there are quite a few) in the tutorial which I am trying to complete:https://developer.atlassian.com/docs/getting-started

Also, since the only documentation I have been able to follow is the tutorial, I am wondering if there are any other touchpoints which will help me to plan and develop my solution. It seems that the others have another information source which I am not aware of.


So, I have a working .js that does exactly what I want it to, I was wondering if there is any way I can run that script on the jira server?