Skip to main content
Skip table of contents

Scoring Fields definition

You can add as many as Scoring fields as you want for your Data Panel

  • Select in the list which Scripted Fields that you want to display.

  • Define a label to display

  • Set the order to display scoring fields, in the table footer.


One scripted field should only be associated with one. To get consistency in the score and the data displayed in the panel, do not share a scripted field between further panels.

Define a scoring rule

For each scoring field you should use the add-on Script Runner.

From the Add-on menu, click on the sub-menu Script Fields.

You should :

  • Define your script

  • Choose the type of field, in or case it a Number Field

Example of script.

CODE
import com.atlassian.jira.ComponentManager
import com.atlassian.plugin.PluginAccessor
  
import java.util.HashMap
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
  
enableCache = {-> false}
  
PluginAccessor pluginAccessor = componentManager.getPluginAccessor();
Class dataPanelScoringServiceClass = pluginAccessor.getClassLoader().findClass("com.valiantys.jira.plugins.exocet.service.DataPanelScoringService");
  
def dataPanelScoringService = componentManager.getOSGiComponentInstanceOfType(dataPanelScoringServiceClass);
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
  
def members = customFieldManager.getCustomFieldObjectByName("Members");
  
Double somme= 0;
  
for (returnedIssue in dataPanelScoringService.getSetOfIssuesByCfName("SCORE",issue)){
         somme += returnedIssue.getCustomFieldValue(members);
}
  
return somme;

What you have to know to be fully integrated into a Data Panel 

  • Get the set of issue according to the data panel previoulsy configured

First get access to the public service provided by Copy & Sync.

CODE
PluginAccessor pluginAccessor = componentManager.getPluginAccessor();
Class dataPanelScoringServiceClass = pluginAccessor.getClassLoader().findClass("com.valiantys.jira.plugins.exocet.service.DataPanelScoringService");


Then iterate on the Issue displayed by the panel

CODE
for (returnedIssue in dataPanelScoringService.getSetOfIssuesByCfName("SCORE",issue)){
         somme += returnedIssue.getCustomFieldValue(members);
}

As you can see, the retieved set of issues is depending of the current Scripted Fields, in our case "SCORE".

This is precisely the limitation seen previously. One Scripted Field should be associated only with one Data Panel

  • The cache must be disabled.

CODE
enableCache = {-> false}

  • Limitations in the computing rules

With groovy there is no limitation in your formula. Do the script you want with Script Runner and exocet will display the result in a pretty web panel.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.