How to do it...

Once you have installed the ScriptRunner for Jira add-on, we will first need to create what is known as a behavior:

  1. Log into Jira with a user that has a Jira administrator's permission.
  2. Navigate to Administration > Manage apps > Behaviors.
  3. Create a new behavior by entering a name for it and clicking the Add button.

With the new behavior created, we need to first create a mapping, so Jira will know what to apply the behavior to:

  1. Click on the Add Mapping link of the new behavior we have created.
  2. Select All projects and Bug issue type for our mapping.
  3. Click the Add Mapping button to save the setting.

With the mapping created, we can now start setting default values:

  1. Click on the Fields link of the new behavior we have created.
  2. Click on the Create initialiser link:

  1. Enter the following code into the text editor:
1.     def desc = getFieldById("description")
2. def defaultValue = ""
3. h2. Describe the problem
4. Tell us in details what the problem you are having.
5.
6. h2. How to reproduce
7. List out the steps to reproduce the problem.
8. * step 1
9. * step 2
10.
11. h2. Expected Result
12. Tell us what you think the correct outcome should be after completing the steps 13. listed above.
14.
15. h2. Actual Result
16. Tell us what you actually see after completing the steps listed above."""
17.
18. if (!underlyingIssue?.description) {
19. desc.setFormValue(defaultValue)
20. }
  1. Click on Save to save our changes.

Now, if you try to create a new Bug issue, you should see the Description field pre-populated with our default value, as shown here:

We will now go have a look at how the steps work.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.72.165