How to run a script when the user click Edit button

Jirong Hu July 30, 2019

Apologize for the long message, just try to give some background information. Please jump to the questions if you don't want to know the history.

I want to migrate a legacy system from CQ to JIRA, it's ClearCase/ClearQuest/BuildForge integrated to do the build and deployment. In CQ it was implemented like this:

1. A CQ activity (BaseCMActivity) has the list of files been changed, just like a JIRA task integrated with git.

2. In the above activity, there is a tab for deployment, inside there are multiple environments with multiple servers represented by checkboxes, e.g. the A server in DEV environment is a checkbox A, the B server in DEV env is another checkbox B.  The number of servers in each env is fixed, never change. There is a Deploy button for each environment.

3. To deploy files in the activity to the servers, the user choose to edit the activity, select the checkboxes, and click the Deploy button to deploy.

 

Now if I create the exact same UI in JIRA, with:

1. Custom fields to implement all checkbox,

2. A ScriptRunner web-item to replace the Deploy button,

 

The question is:

1. How to run a script when the user click Edit button in the issue? Here I need the script to check the current deployment status and get the options selected in each checkbox, etc.

2. How to run a script when the user Update the issue? Here I need the script to launch a remote Jenkins job with all the information passing over. I was looking at ScriptRunner even listener.

3. How to disable the Quick Edit of these checkbox? I see this option is no longer available. So what I want to do is to run a script to compare the previous options checked with the current, and stop the edit if the user wants to uncheck the previous checked checkbox.

 

Also, if you have a better solution with JIRA, please let me know. I am also evaluating using a sub-task to represent each environment.

 

Thanks

Jirong

 

1 answer

0 votes
Yury Lubanets August 2, 2019

Hi @Jirong Hu 

1. In Jira when a user clicks Edit button Edit issue screen appears. You can use Scriptrunner's Behaviours to manipulate it. For checking a deployment status you can send POST request from the script.

2. Yes, I think Scriptrunner's listener is only one solution for this purpose.

3. Do you mean Inline edit? If yes You can disable Quick Edit globally in Jira settings: Administration -> System -> General configuration -> Inline edit

Or through Behaviours :

getFieldByName('FieldName').setAllowInlineEdit(false)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events