Functions

Create Tailored Reports Effortlessly with Jira Assistant's Custom Report Builder

Common functions

Custom functions can help you fetch data and some of the custom functions can update data. Custom functions also lets you do an HTTP call and pull data from Jira or from other API's.

While most of the common functionalities are available as functions, sometimes you may not find what you need. If your usecase is generic and could be helpful for others, please feel free to request for a new common function by raising an issue in GitHub.

You can call any of these functions using following syntax:
Regular function Syntax: CommonFunctions.formatDate(new Date())
Async function Syntax: await CommonFunctions.getWorklogs('JAS-123')

Following are the list of common functions available as on date to use within expressions:

  • getDateRange(startDate : Date, endDate : Date) : Array<Date> - Returns an array of dates between a given date range
  • isBetween(value : Date, fromDate : Date, toDate : Date) : boolean - Returns a boolean value indicating if the given value falls between the from and to (inclusive) date range
  • formatStr(value : string, args : Array<string>) : string - Formats the string by replacing the placeholders with the value being passed
  • numPad(num : int, size : int) : string - Returns a string representing the number padded with 0's to match the given size
  • async httpGet(url : string, [params : object], [headers : object]) : object - Runs a Http GET request on a given url and returns the response from server as JSON Object
  • async httpPost(url : string, [params : object], [headers : object]) : object - Runs a Http POST request on a given url and returns the response from server as JSON Object
  • getUsersFromGroup(group : UserGroup) : Array<string> - Returns the list of users in the given groups. This can be used along with Parameters of type user groups. The result would be primarily useful in JQL for fetching data
  • getJiraIssueUrl(jiraIssueKey : string) : string - Returns Jira issue url based on issue key. This can be used to launch browser tab when clicking on Issue key
  • getUserProfileUrl(userName : string) : string - Returns Jira user profile url based on user name
  • async getTicketDetails(ticketsList : Array<string>, [fields : Array<string>]) : Array<object> - Returns Jira issue details based on the keys provided. Optionally list of fields to be returned by Jira can be provided
  • async executeJQL(jql : string, fields : Array<string>) : Array<object> - Execute the JQL agains Jira and returns the result provided by Jira. Optionally list of fields can be passed to request for specific fields from Jira
  • async getRapidSprintList(rapidIds : Array<int>) : Array<object> - Returns the list of sprints based on rapid board id
  • async getProjectSprintList(projects : Array<int>) : Array<object> - Returns the list of sprints based on project id provided
  • async getRapidSprintDetails(rapidViewId : int, sprintId : string) : object - Return detailed information about the sprint including the list of stories added and removed from sprint along with current status of the stories.
  • async searchUsers(text : string, [maxResult : int], [startAt : int]) : Array<object> - Search for the users matching a term and returns the top 10 paginated users
  • addWorklog(worklog : Worklog) : void - Opens add worklog popup letting the user to add worklog on a specific ticket
  • async getWorklogs(jiraKey : string) : Array<object> - Returns the list of worklog from Jira on a particular ticket
  • async bookmarkTicket(jiraKey : string) : void - Bookmark the provided ticket in Jira Assistant for quick reference
  • formatDate(value : Date, [format : string], [utc : bool]) : string - Format the data object based on user preferences. Only date part of the date object is returned by default
  • formatTime(value : Date, [format : string], [utc : bool]) : string - Format the data object based on user preferences. Only time part of the date object is returned by default
  • formatDateTime(value : Date, [format : string], [utc : bool]) : string - Format the data object based on user preferences
  • getDays(fromDate : Date, toDate : Date) : Array<Day> - Returns the list of days between a given date range along with information like if its a holiday, etc
  • isHoliday(value : Date) : boolean - Check if a specific day is a holiday