Skip to end of banner
Go to start of banner

Default values of (system) fields on create screen

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Required plugins

You will need the following JIRA plugin:

Power Scripts for JIRA (former JJUPIN)

Level: BASIC

The following problem can be solved by Live Fields, included in the Power Scripts for JIRA plugin. Please also read the documentation regarding accessing the current screen with live fields.

Problem

To provide default values for fields in the create screen.

Solution

Here is how you can set the default values on create screen for a specific project.

Let's consider we have a rule, by setting the description, components and affectedVersions on the create issue screen . This allows the reporter to set some fields when the issue is created.

First set up your Live Fields to watch for issueType & project

init.sil
lfInstantHook({"project", "issueType"}, "hook.sil");
lfWatch("issueType", {"issueType", "project"}, "hook.sil");

 

On our hook, we react to the event by setting the fields to what we wish for:

hook.sil
if(argv["screen"] == "create" && contains(argv["project"], "DEMO") && argv["issueType"] == "Bug") {
   //on Create Issue screen
	lfSet("description", "Please describe what's happening: \n\n" +
                         "What you think should be happening: \n" +
                         "Where it's found: \n" + 
                         "Steps to reproduce: \n#action 1\n#action 2\n#action3");
    lfSet("components", {"ui", "business"});
    lfSet("affectedVersions", {"1.0.1", "1.0.2"});
}

That's all.

 

Please notice that this will work only on the popup window for create issue. When creating an issue in new tab, issue type and project system fields are already set, so the hook won't be applied.

 

 

  • No labels