Scripted Report development interface

Adjusting Scripted Reports by yourself

If users want to adjust their report, design and features all by themselves, they can create a new scripted report by copying a report from the gallery.

The configuration page for Scripted Reports includes three tabs: 

  • General: Easily create reports by using predefined input fields

  • Permissions: Provide report access and manage report ownership

  • Template: Define the template of the report by working on HTML

  • Script: Define behaviour to get and pass data by working with JavaScript

  • Split editor: Edit both template and script on a single screen

  • External Editor: Connect JSFiddle or your local IDE to develop the report

General Tab

General Tab

 

Users can fill in the fields with the needed information, select a field type, and watch the preview for your report design below. Users can get the values with the “SR.getValueByFieldName()” method and use it as part of the report script logic.

Report name

Be thoughtful about names. Once you start creating a bunch of reports, it can be tempting to give them “lazy” names. For example, if you created a report called “Project Status” to track your project status, then created another report to track projects delivery, you might be tempted to name it “Project Status” instead of “Project Delivery Status.” That’s a recipe for confusion in your reports. Instead, give your reports descriptive, unique names to ensure clarity.

Input parameters

You can define some input parameters, which will be used in the report calculation logic.

Every field has a data type. A data type indicates what kind of information the field stores. Scripted Deports supports a bunch of different data types, but here are a few you’ll run into.

  • Checkbox — for fields that are a simple “yes” or “no,” a checkbox field is what you want.

  • Date or DateTime — these field types represent dates or date/time combinations, like birthdays or sales milestones.

  • JQL — this special field type holds a Jira Query Language value that’s used to search issues.

Again, there are quite a few field types, but most of them are fairly self-explanatory. The important takeaway is that you want to think about what kind of data you’re trying to use in a report when creating a custom field.

Help out your users. Even with careful field naming, your users might not always be clear about the purpose of a particular input parameter. Include descriptions for your input parameter. For specialized or complicated fields, use help text to give more details.

Require fields when necessary. Always keep in mind that all the fields could be empty; take this into account in your report’s JavaScript. Input parameters validation should be the first part of your script.

 

Permissions Tab

 

In the permission section of your report, you can administrate the view, edit, and admin access for your report. Add other people by clicking the button “Add.”

Template Tab

 

Use the handlebars template engine and work on the HTML code of your scripted report. All conditions are identical, so we recommend handlebars documentation for your convenience. To pass expression values, use SR.render() method.

Script Tab

 

Use the Script tab to work on the JavaScript for your report.

The code is covered with top-level await, which means that you can work the asynchronous code synchronously when you need it.

The SR.render() method is expected to be used inside every report. Without it, the report will not be rendered. The minimum script code is: "SR.render({})".

Depending on the task, you may need to work with created HTML DOM. Handlebars engine doesn't allow that by default, but you can define the callback function as the second parameter of SR.render() to execute code after HTML is rendered.

Split Editor Tab

This tab allows you to edit both template and script at a same time on a single page on-line

External Editor Tab

External editor tab allows you to connect external editors to edit your report.

Find out more about our Gallery for reports, and detailed guides for the reports themselves